summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2015-02-11 08:32:48 -0500
committerMonty Taylor <mordred@inaugust.com>2015-02-11 08:40:51 -0500
commit01d7728504a77bdf03d6e4aa98edd66d55fa13f0 (patch)
tree2d8cb10541c3b04cbd9360935424bcbc2392e64a
parent2bbcb630144975d032ecc312177a11266c2ac57b (diff)
downloados-client-config-01d7728504a77bdf03d6e4aa98edd66d55fa13f0.tar.gz
Make sure we're deep-copying the auth dict
Having a defaults dict that has an empty dict and then does a bunch of updates means you have ONE instance of a dict that all of the other instances have references to. Change-Id: Id008f7ec98ff7b392553cebca5a5b301330e67a3
-rw-r--r--os_client_config/config.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/os_client_config/config.py b/os_client_config/config.py
index bfc030e..95dfaf7 100644
--- a/os_client_config/config.py
+++ b/os_client_config/config.py
@@ -59,7 +59,10 @@ def _auth_update(old_dict, new_dict):
"""Like dict.update, except handling the nested dict called auth."""
for (k, v) in new_dict.items():
if k == 'auth':
- old_dict[k].update(v)
+ if k in old_dict:
+ old_dict[k].update(v)
+ else:
+ old_dict[k] = v.copy()
else:
old_dict[k] = v
return old_dict
@@ -73,7 +76,6 @@ class OpenStackConfig(object):
defaults = dict(
auth_plugin='password',
- auth=dict(),
compute_api_version='1.1',
)
self.defaults = _get_os_environ(defaults)
@@ -273,6 +275,8 @@ class OpenStackConfig(object):
args['region_name'] = self._get_region(cloud)
config = self._get_base_cloud_config(cloud)
+ if 'auth' not in config:
+ config['auth'] = dict()
# Can't just do update, because None values take over
for (key, val) in args.iteritems():