* Fix NameError in pause module
* Add comment and changelog
Co-authored-by: Jerry Chong <jchong@netbase.com>
(cherry picked from commit 42f44b24c6
)
This commit is contained in:
parent
dc37b41b72
commit
67859c3476
2 changed files with 10 additions and 3 deletions
2
changelogs/fragments/pause-try-except-curses.yaml
Normal file
2
changelogs/fragments/pause-try-except-curses.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- pause - nest try except when importing curses to gracefully fail if curses is not present (https://github.com/ansible/ansible/issues/42004)
|
|
@ -39,9 +39,14 @@ except ImportError:
|
|||
|
||||
try:
|
||||
import curses
|
||||
curses.setupterm()
|
||||
HAS_CURSES = True
|
||||
except (ImportError, curses.error):
|
||||
|
||||
# Nest the try except since curses.error is not available if curses did not import
|
||||
try:
|
||||
curses.setupterm()
|
||||
HAS_CURSES = True
|
||||
except curses.error:
|
||||
HAS_CURSES = False
|
||||
except ImportError:
|
||||
HAS_CURSES = False
|
||||
|
||||
if HAS_CURSES:
|
||||
|
|
Loading…
Reference in a new issue