From 0ee9972903ff0c5df9bb3077c9eeab0ac3a050e2 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Thu, 5 Jan 2017 17:11:08 -0800 Subject: [PATCH] Fix constants to use environment variables in preference to config files --- lib/ansible/constants.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index 13727e24dbc..2a121e9d754 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -124,10 +124,6 @@ def get_config(p, section, key, env_var, default, value_type=None, expand_relati def _get_config(p, section, key, env_var, default): ''' helper function for get_config ''' value = default - if env_var is not None: - env_value = os.environ.get(env_var, None) - if env_value is not None: - value = env_value if p is not None: try: @@ -135,6 +131,11 @@ def _get_config(p, section, key, env_var, default): except: pass + if env_var is not None: + env_value = os.environ.get(env_var, None) + if env_value is not None: + value = env_value + return to_text(value, errors='surrogate_or_strict', nonstring='passthru')