Skip to content

Commit d6a23dd

Browse files
committed
pass module spec via stdin instead of command line args. Fixes #4717
1 parent 43e758b commit d6a23dd

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/ansiblelint/rules/args.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,8 @@ def matchtask(
194194
# through `ArgumentSpecValidator` class as in case of modules.
195195
return []
196196

197-
with patch.object(
198-
sys,
199-
"argv",
200-
["", json.dumps({"ANSIBLE_MODULE_ARGS": clean_json(module_args)})],
201-
):
197+
buffer = io.BytesIO(json.dumps({"ANSIBLE_MODULE_ARGS": clean_json(module_args)}).encode())
198+
with patch.object(sys, "stdin", io.TextIOWrapper(buffer)), patch.object(sys, "argv", [""]):
202199
fio = io.StringIO()
203200
failed_msg = ""
204201
# Warning: avoid running anything while stdout is redirected

0 commit comments

Comments
 (0)