summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2017-01-25 10:14:19 -0600
committerGitHub <noreply@github.com>2017-01-25 10:14:19 -0600
commit28e39ca42f30373c0500282e77c622c45fa1f783 (patch)
treeaf7f2889f23e020e52873a22221b4031ff726ea8
parente5f7a222153ffdf7c1e94ee2719b70e3d0a904b5 (diff)
downloadansible-28e39ca42f30373c0500282e77c622c45fa1f783.tar.gz
Make sure values are strings before performing rstrip. Fixes #20641 (#20643)
-rw-r--r--lib/ansible/modules/commands/expect.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ansible/modules/commands/expect.py b/lib/ansible/modules/commands/expect.py
index 39b6a8ed33..fddecd2cfd 100644
--- a/lib/ansible/modules/commands/expect.py
+++ b/lib/ansible/modules/commands/expect.py
@@ -107,7 +107,7 @@ EXAMPLES = '''
def response_closure(module, question, responses):
- resp_gen = (u'%s\n' % r.rstrip('\n').decode() for r in responses)
+ resp_gen = (u'%s\n' % str(r).rstrip('\n').decode() for r in responses)
def wrapped(info):
try:
@@ -150,7 +150,7 @@ def main():
if isinstance(value, list):
response = response_closure(module, key, value)
else:
- response = u'%s\n' % value.rstrip('\n').decode()
+ response = u'%s\n' % str(value).rstrip('\n').decode()
events[key.decode()] = response