diff --git a/changelogs/fragments/45631-empty-cow-whitelist.yml b/changelogs/fragments/45631-empty-cow-whitelist.yml new file mode 100644 index 00000000000..dd556c63253 --- /dev/null +++ b/changelogs/fragments/45631-empty-cow-whitelist.yml @@ -0,0 +1,2 @@ +bugfixes: +- cowsay - Fix issue with an empty cow_whitelist (https://github.com/ansible/ansible/issues/45631) diff --git a/lib/ansible/utils/display.py b/lib/ansible/utils/display.py index 6735cf66f45..b0253c8317d 100644 --- a/lib/ansible/utils/display.py +++ b/lib/ansible/utils/display.py @@ -110,7 +110,7 @@ class Display(with_metaclass(Singleton, object)): cmd = subprocess.Popen([self.b_cowsay, "-l"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = cmd.communicate() 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) except Exception: # could not execute cowsay for some reason