mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Update test-module (#20737)
* Update test-module Ensuring invoke is assigned Traceback (most recent call last): File "ansible/hacking/test-module", line 267, in <module> main() File "ansible/hacking/test-module", line 263, in main runtest(modfile, argspath, modname, module_style, interpreters) File "ansible/hacking/test-module", line 207, in runtest invoke = "%s%s" % (invoke, modfile) UnboundLocalError: local variable 'invoke' referenced before assignment * Update test-module Made the change to only require a single if, making the function more 'DRY'.
This commit is contained in:
parent
01f4d4a666
commit
ba39d1158c
1 changed files with 1 additions and 2 deletions
|
@ -195,12 +195,11 @@ def ansiballz_setup(modfile, modname, interpreters):
|
||||||
|
|
||||||
def runtest(modfile, argspath, modname, module_style, interpreters):
|
def runtest(modfile, argspath, modname, module_style, interpreters):
|
||||||
"""Test run a module, piping it's output for reporting."""
|
"""Test run a module, piping it's output for reporting."""
|
||||||
|
invoke = ""
|
||||||
if module_style == 'ansiballz':
|
if module_style == 'ansiballz':
|
||||||
modfile, argspath = ansiballz_setup(modfile, modname, interpreters)
|
modfile, argspath = ansiballz_setup(modfile, modname, interpreters)
|
||||||
if 'ansible_python_interpreter' in interpreters:
|
if 'ansible_python_interpreter' in interpreters:
|
||||||
invoke = "%s " % interpreters['ansible_python_interpreter']
|
invoke = "%s " % interpreters['ansible_python_interpreter']
|
||||||
else:
|
|
||||||
invoke = ""
|
|
||||||
|
|
||||||
os.system("chmod +x %s" % modfile)
|
os.system("chmod +x %s" % modfile)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue