summaryrefslogtreecommitdiff
path: root/commands/expect.py
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2016-08-09 10:36:45 -0500
committerGitHub <noreply@github.com>2016-08-09 10:36:45 -0500
commit35aa1a5a813519c37fdddce8ab27c31cdf9a106a (patch)
tree36803a886cea542f6354443c371263f49da16fe4 /commands/expect.py
parent93472c3c542a68f5be45d4c2381a9d8e82f2f04e (diff)
downloadansible-modules-extras-35aa1a5a813519c37fdddce8ab27c31cdf9a106a.tar.gz
If rc is null, assume that a timeout happened. Fixes #2484 (#2485)
Diffstat (limited to 'commands/expect.py')
-rw-r--r--commands/expect.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/commands/expect.py b/commands/expect.py
index 45921794..4b5e5e8d 100644
--- a/commands/expect.py
+++ b/commands/expect.py
@@ -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 *