From dfd885a012bda825e98c9e1b086f318f1eb7a154 Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Tue, 23 Apr 2013 16:40:11 +0200 Subject: [PATCH] Make ANSIBLE_NOCOWS configurable nocows = 1 in ansible.cfg or old environment variable ANSIBLE_NOCOWS=1 add to ansible.cfg example --- examples/ansible.cfg | 4 ++++ lib/ansible/callbacks.py | 3 ++- lib/ansible/constants.py | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/ansible.cfg b/examples/ansible.cfg index 6f472bf66b..aaffca9f9f 100644 --- a/examples/ansible.cfg +++ b/examples/ansible.cfg @@ -125,6 +125,10 @@ lookup_plugins = /usr/share/ansible_plugins/lookup_plugins vars_plugins = /usr/share/ansible_plugins/vars_plugins filter_plugins = /usr/share/ansible_plugins/filter_plugins +# set to 1 if you don't want cowsay support. Alternatively, set ANSIBLE_NOCOWS=1 +# in your environment +# nocows = 1 + [paramiko_connection] # nothing to configure yet diff --git a/lib/ansible/callbacks.py b/lib/ansible/callbacks.py index 75299e7284..a73f7a84d2 100644 --- a/lib/ansible/callbacks.py +++ b/lib/ansible/callbacks.py @@ -23,9 +23,10 @@ import subprocess import random import fnmatch from ansible.color import stringc +import ansible.constants as C cowsay = None -if os.getenv("ANSIBLE_NOCOWS") is not None: +if C.ANSIBLE_NOCOWS is not None: cowsay = None elif os.path.exists("/usr/bin/cowsay"): cowsay = "/usr/bin/cowsay" diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index fb6af67afc..b11a796062 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -103,6 +103,7 @@ DEFAULT_CONNECTION_PLUGIN_PATH = shell_expand_path(get_config(p, DEFAULTS, 'conn DEFAULT_LOOKUP_PLUGIN_PATH = shell_expand_path(get_config(p, DEFAULTS, 'lookup_plugins', 'ANSIBLE_LOOKUP_PLUGINS', '/usr/share/ansible_plugins/lookup_plugins')) DEFAULT_VARS_PLUGIN_PATH = shell_expand_path(get_config(p, DEFAULTS, 'vars_plugins', 'ANSIBLE_VARS_PLUGINS', '/usr/share/ansible_plugins/vars_plugins')) DEFAULT_FILTER_PLUGIN_PATH = shell_expand_path(get_config(p, DEFAULTS, 'filter_plugins', 'ANSIBLE_FILTER_PLUGINS', '/usr/share/ansible_plugins/filter_plugins')) +ANSIBLE_NOCOWS = get_config(p, DEFAULTS, 'nocows', 'ANSIBLE_NOCOWS', None) # non-configurable things DEFAULT_SUDO_PASS = None