From c3fc2d27d91cb74b6b604d6a249c3df577c6807a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=B9=BF?= Date: Mon, 29 Jun 2020 22:37:40 +0800 Subject: [PATCH] pause - fix curses.setupterm() error (#47851) * [Bugfix] curses.setupterm() error When run playbook in celery task, curses.setupterm() will be failed ``` File "", line 675, in _load File "", line 655, in _load_unlocked File "", line 678, in exec_module File "", line 205, in _call_with_frames_removed File "/Users/guang/.virtualenvs/ansible/lib/python3.6/site-packages/ansible/plugins/action/pause.py", line 45, in curses.setupterm() TypeError: argument must be an int, or have a fileno() method. ``` * Add changelog Co-authored-by: Sam Doran --- changelogs/fragments/pause-catch-error-when-no-std-exists.yml | 2 ++ lib/ansible/plugins/action/pause.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/pause-catch-error-when-no-std-exists.yml diff --git a/changelogs/fragments/pause-catch-error-when-no-std-exists.yml b/changelogs/fragments/pause-catch-error-when-no-std-exists.yml new file mode 100644 index 00000000000..040483b4a31 --- /dev/null +++ b/changelogs/fragments/pause-catch-error-when-no-std-exists.yml @@ -0,0 +1,2 @@ +bugfixes: + - pause - handle exception when there is no stdout (https://github.com/ansible/ansible/pull/47851) diff --git a/lib/ansible/plugins/action/pause.py b/lib/ansible/plugins/action/pause.py index 3a965a875e6..86bd7e1ed94 100644 --- a/lib/ansible/plugins/action/pause.py +++ b/lib/ansible/plugins/action/pause.py @@ -41,7 +41,7 @@ try: try: curses.setupterm() HAS_CURSES = True - except curses.error: + except (curses.error, TypeError): HAS_CURSES = False except ImportError: HAS_CURSES = False