diff options
author | Michael Scherer <misc@zarb.org> | 2016-10-15 16:13:10 +0200 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2016-10-15 08:30:01 -0700 |
commit | e0eb86a5000c1913c8e2925cf2b25a809aab02ef (patch) | |
tree | 2b58f089b15537aaec904bed31086b05cef6b842 | |
parent | fb228d682d862ad1572295f74acbf0e10d290106 (diff) | |
download | ansible-modules-extras-e0eb86a5000c1913c8e2925cf2b25a809aab02ef.tar.gz |
Make expect module compile on python 3
-rw-r--r-- | commands/expect.py | 7 | ||||
-rw-r--r-- | test/utils/shippable/sanity-skip-python3.txt | 1 |
2 files changed, 5 insertions, 3 deletions
diff --git a/commands/expect.py b/commands/expect.py index 355f2cff..c6f70e75 100644 --- a/commands/expect.py +++ b/commands/expect.py @@ -195,7 +195,8 @@ def main(): # Use pexpect.runu in pexpect>=3.3,<4 out, rc = pexpect.runu(args, timeout=timeout, withexitstatus=True, events=events, cwd=chdir, echo=echo) - except (TypeError, AttributeError), e: + except (TypeError, AttributeError): + e = get_exception() # This should catch all insufficient versions of pexpect # We deem them insufficient for their lack of ability to specify # to not echo responses via the run/runu functions, which would @@ -203,7 +204,8 @@ def main(): module.fail_json(msg='Insufficient version of pexpect installed ' '(%s), this module requires pexpect>=3.3. ' 'Error was %s' % (pexpect.__version__, e)) - except pexpect.ExceptionPexpect, e: + except pexpect.ExceptionPexpect: + e = get_exception() module.fail_json(msg='%s' % e) endd = datetime.datetime.now() @@ -230,5 +232,6 @@ def main(): # import module snippets from ansible.module_utils.basic import * +from ansible.module_utils.pycompat24 import get_exception main() diff --git a/test/utils/shippable/sanity-skip-python3.txt b/test/utils/shippable/sanity-skip-python3.txt index 5e735277..c255551a 100644 --- a/test/utils/shippable/sanity-skip-python3.txt +++ b/test/utils/shippable/sanity-skip-python3.txt @@ -46,7 +46,6 @@ /clustering/consul_acl.py /clustering/consul_kv.py /clustering/consul_session.py -/commands/expect.py /database/misc/mongodb_parameter.py /database/misc/mongodb_user.py /database/misc/redis.py |