mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
Command module bug fix, tests and cleanup. (#30432)
* Add more command integration tests. * Remove unnecessary command test debug tasks. * Fix traceback in command module for empty args. * Remove unreachable code.
This commit is contained in:
parent
f128796782
commit
4ce13e983a
2 changed files with 64 additions and 10 deletions
|
@ -144,7 +144,7 @@ def main():
|
|||
module.warn("As of Ansible 2.4, the parameter 'executable' is no longer supported with the 'command' module. Not using '%s'." % executable)
|
||||
executable = None
|
||||
|
||||
if args.strip() == '':
|
||||
if not args or args.strip() == '':
|
||||
module.fail_json(rc=256, msg="no command given")
|
||||
|
||||
if chdir:
|
||||
|
@ -187,11 +187,6 @@ def main():
|
|||
endd = datetime.datetime.now()
|
||||
delta = endd - startd
|
||||
|
||||
if out is None:
|
||||
out = b''
|
||||
if err is None:
|
||||
err = b''
|
||||
|
||||
result = dict(
|
||||
cmd=args,
|
||||
stdout=out.rstrip(b"\r\n"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue