1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-11 14:35:06 +00:00
community.general/tests/utils/clean-aliases-skips
Alexei Znamensky 68ae04a95a
Cleanup of aliases skip statements (#11686)
* add scripts to clean aliases' skips

* remove legacy skips

* code cosmetics

* add license to ALIASES.md

* Fix typos in ALIASES.md documentation

* rolling back freebsd14.2 and 14.3 in iso_extract

* fix versions and re-run
2026-03-30 19:31:17 +02:00

42 lines
1.1 KiB
Python
Executable file

#!/usr/bin/env python
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
import re
import sys
from pathlib import Path
def sanitize(filepath, remotes_re):
with open(filepath) as fileread:
lines = fileread.readlines()
changed = False
out_lines = []
for ll in lines:
if not ll.startswith("skip/") or any(r.match(ll) for r in remotes_re):
out_lines.append(ll)
continue
changed = True
if changed:
print(f"sanitizing {filepath}", file=sys.stderr)
with open(filepath, "w") as filewrite:
filewrite.writelines(out_lines)
def main():
remotes = [x.strip() for x in sys.stdin.readlines()]
remotes.append("docker")
print(f"Valid remotes: {', '.join(remotes)}", file=sys.stderr)
remotes_re = [re.compile(rf"^skip/{r}(\s.*)?$") for r in remotes]
for filepath in Path("tests/integration/targets").glob("*/aliases"):
sanitize(filepath, remotes_re)
if __name__ == "__main__":
main()