If rc is null, assume that a timeout happened. Fixes #2484 (#2485)

This commit is contained in:
Matt Martz 2016-08-09 10:36:45 -05:00 committed by Matt Clay
parent 87be961c1d
commit ed832c89f4

View file

@ -214,7 +214,7 @@ def main():
if out is None:
out = ''
module.exit_json(
ret = dict(
cmd=args,
stdout=out.rstrip('\r\n'),
rc=rc,
@ -224,6 +224,12 @@ def main():
changed=True,
)
if rc:
module.exit_json(**ret)
else:
ret['msg'] = 'command exceeded timeout'
module.fail_json(**ret)
# import module snippets
from ansible.module_utils.basic import *