From f64b276f6ab2cc5bc85f7ad929aaca59a9e6e53e Mon Sep 17 00:00:00 2001 From: Matt Bachmann Date: Sun, 3 Dec 2017 14:33:18 -0500 Subject: [PATCH] Add option allowing the user to specify a custom cowpath This allows the user to use custom cowsay implementations without shadowing common cowsay paths --- lib/ansible/config/base.yml | 9 +++++++++ lib/ansible/utils/display.py | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 0eabb4593ce..cb60781b98e 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -56,6 +56,15 @@ ANSIBLE_NOCOWS: - {key: nocows, section: defaults} type: boolean yaml: {key: display.i_am_no_fun} +ANSIBLE_COWPATH: + name: Set path to cowsay command + default: null + description: Specify a custom cowsay path or swap in your cowsay implementation of choice + env: [{name: ANSIBLE_COWPATH}] + ini: + - {key: cowpath, section: defaults} + type: string + yaml: {key: display.cowpath} ANSIBLE_PIPELINING: name: Connection pipelining default: False diff --git a/lib/ansible/utils/display.py b/lib/ansible/utils/display.py index d40d8dc2dbf..593644ded47 100644 --- a/lib/ansible/utils/display.py +++ b/lib/ansible/utils/display.py @@ -98,7 +98,12 @@ class Display: self._set_column_width() def set_cowsay_info(self): - if not C.ANSIBLE_NOCOWS: + if C.ANSIBLE_NOCOWS: + return + + if C.ANSIBLE_COWPATH: + self.b_cowsay = C.ANSIBLE_COWPATH + else: for b_cow_path in b_COW_PATHS: if os.path.exists(b_cow_path): self.b_cowsay = b_cow_path