diff options
author | Brian Coca <bcoca@users.noreply.github.com> | 2021-12-07 09:11:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-07 09:11:06 -0500 |
commit | 472028c869669dc05abd110ba8a335326c13ba8c (patch) | |
tree | ab6d4024416fc1952fa8a0bddea067b588a29306 /lib/ansible/utils | |
parent | 60d094db730863cbab15bb920be8986175ec73a9 (diff) | |
download | ansible-472028c869669dc05abd110ba8a335326c13ba8c.tar.gz |
catch the case that cowsay is broken (#76326)
* catch the case that cowsay is broken
fixes https://github.com/ansible/ansible/issues/72582
add changelog
raise Exception for broken cowsay
add test for broken cowsay
Co-authored-by: Matthias Bernt <m.bernt@ufz.de>
Diffstat (limited to 'lib/ansible/utils')
-rw-r--r-- | lib/ansible/utils/display.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/ansible/utils/display.py b/lib/ansible/utils/display.py index 86237ef85a..a1a45b2def 100644 --- a/lib/ansible/utils/display.py +++ b/lib/ansible/utils/display.py @@ -219,7 +219,9 @@ class Display(metaclass=Singleton): try: cmd = subprocess.Popen([self.b_cowsay, "-l"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = cmd.communicate() - self.cows_available = {to_text(c) for c in out.split()} + if cmd.returncode: + raise Exception + self.cows_available = {to_text(c) for c in out.split()} # set comprehension if C.ANSIBLE_COW_ACCEPTLIST and any(C.ANSIBLE_COW_ACCEPTLIST): self.cows_available = set(C.ANSIBLE_COW_ACCEPTLIST).intersection(self.cows_available) except Exception: |