fix(validation): refuse a specs argument that is not a list

This commit is contained in:
2026-10-05 18:50:09 +02:00
parent 7129ceb515
commit b6620260d5
2 changed files with 22 additions and 1 deletions
+4 -1
View File
@@ -117,7 +117,10 @@ class ActionModule(ActionBase):
paths = []
# A pattern (`.../*/roles/*/meta/argument_specs.yml`) picks up every role's spec without a list
# to keep in sync; one that matches nothing is a broken path, not an empty set.
for entry in self._task.args["specs"]:
specs = self._task.args["specs"]
if not isinstance(specs, list):
raise AnsibleError(f"specs must be a list of spec file paths, got {type(specs).__name__}")
for entry in specs:
matches = sorted(glob.glob(entry)) if glob.has_magic(entry) else [entry]
if not matches:
raise AnsibleError(f"no spec file matches {entry}")