Fix issue with empty cow_whitelist (#59946)

* Fix issue with empty cow_whitelist. Fixes #45631

* Account for None
pull/60018/head
Matt Martz 5 years ago committed by GitHub
parent f3e20346cb
commit 38eee51057
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- cowsay - Fix issue with an empty cow_whitelist (https://github.com/ansible/ansible/issues/45631)

@ -110,7 +110,7 @@ class Display(with_metaclass(Singleton, object)):
cmd = subprocess.Popen([self.b_cowsay, "-l"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) cmd = subprocess.Popen([self.b_cowsay, "-l"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(out, err) = cmd.communicate() (out, err) = cmd.communicate()
self.cows_available = set([to_text(c) for c in out.split()]) self.cows_available = set([to_text(c) for c in out.split()])
if C.ANSIBLE_COW_WHITELIST: if C.ANSIBLE_COW_WHITELIST and any(C.ANSIBLE_COW_WHITELIST):
self.cows_available = set(C.ANSIBLE_COW_WHITELIST).intersection(self.cows_available) self.cows_available = set(C.ANSIBLE_COW_WHITELIST).intersection(self.cows_available)
except Exception: except Exception:
# could not execute cowsay for some reason # could not execute cowsay for some reason

Loading…
Cancel
Save