Fix bin/ansible to not make a double traceback on python3 (#15972)

pull/16104/head
Michael Scherer 8 years ago committed by Toshio Kuratomi
parent 805e0ec529
commit f0023610e8

@ -82,7 +82,12 @@ if __name__ == '__main__':
else:
raise AnsibleError("Unknown Ansible alias: %s" % me)
except ImportError as e:
if e.message.endswith(' %s' % sub):
# ImportError members have changed in py3
if 'msg' in dir(e):
msg = e.msg
else:
msg = e.message
if msg.endswith(' %s' % sub):
raise AnsibleError("Ansible sub-program not implemented: %s" % me)
else:
raise

Loading…
Cancel
Save