diff --git a/changelogs/fragments/reboot-fix-exception-type.yaml b/changelogs/fragments/reboot-fix-exception-type.yaml new file mode 100644 index 00000000000..43f5680856b --- /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 160ef9bce11..ba331a4c136 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))