Files
community.general/tests/utils/clean-aliases-skips
patchback[bot] 66d394dc81 [PR #11686/68ae04a9 backport][stable-12] Cleanup of aliases skip statements (#11709)
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

(cherry picked from commit 68ae04a95a)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2026-03-30 19:58:13 +02:00

43 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()