From ca8261ed317fea7415828ab8a80f44c3f3d15d9c Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Tue, 19 Jan 2016 14:06:56 -0800 Subject: [PATCH] Don't tracback trying to retore settings Can occur if we exit the timeout before the settings were changed --- lib/ansible/plugins/action/pause.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/action/pause.py b/lib/ansible/plugins/action/pause.py index f3a70ed7e3..97fa9ac320 100644 --- a/lib/ansible/plugins/action/pause.py +++ b/lib/ansible/plugins/action/pause.py @@ -105,6 +105,8 @@ class ActionModule(ActionBase): result['start'] = str(datetime.datetime.now()) result['user_input'] = '' + fd = None + old_settings = None try: if seconds is not None: # setup the alarm handler @@ -159,7 +161,7 @@ class ActionModule(ActionBase): finally: # cleanup and save some information # restore the old settings for the duped stdin fd - if isatty(fd): + if not(None in (fd, old_settings)) and isatty(fd): termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) duration = time.time() - start