diff options
author | Sam Doran <sdoran@redhat.com> | 2018-12-04 14:12:00 -0500 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2018-12-05 10:34:28 -0800 |
commit | 91b23473443463375b7f7e9fe2a427d43cb9cf48 (patch) | |
tree | 646473f2e0059f0dba27aea5de6f5ed5ccbee03e | |
parent | 799f8e97b3b0e0340ec4facf78d6da974d3dace9 (diff) | |
download | ansible-91b23473443463375b7f7e9fe2a427d43cb9cf48.tar.gz |
[stable-2.7] Use IndexError in exception (#49488)
(cherry picked from commit 6200d32c0d)
Co-authored-by: Sam Doran <sdoran@redhat.com>
-rw-r--r-- | changelogs/fragments/reboot-fix-exception-type.yaml | 2 | ||||
-rw-r--r-- | lib/ansible/plugins/action/reboot.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/changelogs/fragments/reboot-fix-exception-type.yaml b/changelogs/fragments/reboot-fix-exception-type.yaml new file mode 100644 index 0000000000..43f5680856 --- /dev/null +++ b/changelogs/fragments/reboot-fix-exception-type.yaml @@ -0,0 +1,2 @@ +bugfixes: + - reboot - use IndexError instead of TypeError in exception diff --git a/lib/ansible/plugins/action/reboot.py b/lib/ansible/plugins/action/reboot.py index 160ef9bce1..ba331a4c13 100644 --- a/lib/ansible/plugins/action/reboot.py +++ b/lib/ansible/plugins/action/reboot.py @@ -189,7 +189,7 @@ class ActionModule(ActionBase): if action_desc: try: error = to_text(e).splitlines()[-1] - except TypeError as e: + except IndexError as e: error = to_text(e) display.debug("{0}: {1} fail '{2}', retrying in {3:.4} seconds...".format(self._task.action, action_desc, error, fail_sleep)) |