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:
Matt Clay 2017-09-15 11:57:50 -07:00 committed by GitHub
parent f128796782
commit 4ce13e983a
2 changed files with 64 additions and 10 deletions

View file

@ -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"),