From c6d2aeada4d9074f185f9748a81f7c651614e347 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 15 Sep 2016 16:41:17 -0500 Subject: [PATCH] Don't create envvars cloud if cloud or region are set OS_CLOUD and OS_REGION_NAME are both selectors. If they are the only values, we should not be creating an envvars cloud. Change-Id: I1b7c8d7e3b6c300bd2c85ab482a22411370e4d5f --- os_client_config/config.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/os_client_config/config.py b/os_client_config/config.py index 646e55d..aa6ef7e 100644 --- a/os_client_config/config.py +++ b/os_client_config/config.py @@ -105,12 +105,11 @@ def _get_os_environ(envvar_prefix=None): for k in environkeys: newkey = k.split('_', 1)[-1].lower() ret[newkey] = os.environ[k] - # If the only environ key is region name, don't make a cloud, because - # it's being used as a cloud selector - if not environkeys or ( - len(environkeys) == 1 and 'region_name' in ret): - return None - return ret + # If the only environ keys are cloud and region_name, don't return anything + # because they are cloud selectors + if set(environkeys) - set(['OS_CLOUD', 'OS_REGION_NAME']): + return ret + return None def _merge_clouds(old_dict, new_dict):