Adding a new system_warnings config option to supress warnings

This commit is contained in:
James Cammarata 2014-04-30 14:44:10 -05:00
parent bf7c51ad8a
commit 6069ff6e9e
4 changed files with 34 additions and 3 deletions

View file

@ -477,6 +477,19 @@ playbook. The default is the most logical: 'root'::
sudo_user=root
.. _system_warnings:
system_warnings
===============
.. versionadded:: 1.6
Allows disabling of warnings related to potential issues on the system running ansible itself (not on the managed hosts)::
system_warnings = True
These may include warnings about 3rd party packages or other conditions that should be resolved if possible.
.. _timeout:
timeout

View file

@ -91,6 +91,17 @@ ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid}
# to revert the behavior to pre-1.3.
#error_on_undefined_vars = False
# by default (as of 1.6), Ansible may display warnings based on the configuration of the
# system running ansible itself. This may include warnings about 3rd party packages or
# other conditions that should be resolved if possible.
# to disable these warnings, set the following value to False:
#system_warnings = True
# by default (as of 1.4), Ansible may display deprecation warnings for language
# features that should no longer be used and will be removed in future versions.
# to disable these warnings, set the following value to False:
#deprecation_warnings = True
# set plugin path directories here, separate with colons
action_plugins = /usr/share/ansible_plugins/action_plugins
callback_plugins = /usr/share/ansible_plugins/callback_plugins

View file

@ -150,6 +150,7 @@ ANSIBLE_NOCOWS = get_config(p, DEFAULTS, 'nocows', 'ANSIBLE_NOCO
DISPLAY_SKIPPED_HOSTS = get_config(p, DEFAULTS, 'display_skipped_hosts', 'DISPLAY_SKIPPED_HOSTS', True, boolean=True)
DEFAULT_UNDEFINED_VAR_BEHAVIOR = get_config(p, DEFAULTS, 'error_on_undefined_vars', 'ANSIBLE_ERROR_ON_UNDEFINED_VARS', True, boolean=True)
HOST_KEY_CHECKING = get_config(p, DEFAULTS, 'host_key_checking', 'ANSIBLE_HOST_KEY_CHECKING', True, boolean=True)
SYSTEM_WARNINGS = get_config(p, DEFAULTS, 'system_warnings', 'ANSIBLE_SYSTEM_WARNINGS', True, boolean=True)
DEPRECATION_WARNINGS = get_config(p, DEFAULTS, 'deprecation_warnings', 'ANSIBLE_DEPRECATION_WARNINGS', True, boolean=True)
# CONNECTION RELATED

View file

@ -44,7 +44,6 @@ import getpass
import sys
import textwrap
import json
import warnings
#import vault
from vault import VaultLib
@ -83,8 +82,11 @@ try:
import keyczar.errors as key_errors
from keyczar.keys import AesKey
except PowmInsecureWarning:
display("The version of gmp you have installed has a known issue regarding timing vulnerabilities when used with pycrypto. " + \
"If possible, you should update it (ie. yum update gmp).", color="purple", stderr=True)
system_warning(
"The version of gmp you have installed has a known issue regarding " + \
"timing vulnerabilities when used with pycrypto. " + \
"If possible, you should update it (ie. yum update gmp)."
)
warnings.resetwarnings()
warnings.simplefilter("ignore")
import keyczar.errors as key_errors
@ -1155,6 +1157,10 @@ def warning(msg):
display(new_msg, color='bright purple', stderr=True)
warns[new_msg] = 1
def system_warning(msg):
if C.SYSTEM_WARNINGS:
warning(msg)
def combine_vars(a, b):
if C.DEFAULT_HASH_BEHAVIOUR == "merge":