Skip to content

Commit

Permalink
Make expect module compile on python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
mscherer authored and mattclay committed Dec 8, 2016
1 parent 415c2d4 commit da6851b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/ansible/modules/extras/commands/expect.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,17 @@ 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
# potentially leak sensentive information
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()
Expand All @@ -230,5 +232,6 @@ def main():

# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.pycompat24 import get_exception

main()
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit da6851b

Please sign in to comment.