summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2015-05-27 08:46:21 -0400
committerMonty Taylor <mordred@inaugust.com>2015-05-27 12:11:07 -0400
commit5a4f809caf2223121803debab2e6ac52bc943116 (patch)
tree70bfd492629c2cef3e1f7cb241e2db2ce104e5aa
parentf3eb3d47bc51c5c4dbf8a609c27e99cf9abaca53 (diff)
downloados-client-config-5a4f809caf2223121803debab2e6ac52bc943116.tar.gz
Capture the filename used for config
Consumers who may want to watch for config file changes would find such a thing interesting information. Change-Id: I66c59c6acdbb930f013d4742d5b3cc7e35a922d4
-rw-r--r--os_client_config/config.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/os_client_config/config.py b/os_client_config/config.py
index c5b6d9b..b9c89c2 100644
--- a/os_client_config/config.py
+++ b/os_client_config/config.py
@@ -108,7 +108,7 @@ class OpenStackConfig(object):
self.defaults.update(override_defaults)
# First, use a config file if it exists where expected
- self.cloud_config = self._load_config_file()
+ self.config_filename, self.cloud_config = self._load_config_file()
if not self.cloud_config:
self.cloud_config = {'clouds': {}}
@@ -161,7 +161,8 @@ class OpenStackConfig(object):
for path in filelist:
if os.path.exists(path):
with open(path, 'r') as f:
- return self._normalize_keys(yaml.safe_load(f))
+ return path, self._normalize_keys(yaml.safe_load(f))
+ return (None, None)
def _normalize_keys(self, config):
new_config = {}
@@ -216,7 +217,7 @@ class OpenStackConfig(object):
# for this.
profile_name = our_cloud.get('profile', our_cloud.get('cloud', None))
if profile_name:
- vendor_file = self._load_vendor_file()
+ vendor_filename, vendor_file = self._load_vendor_file()
if vendor_file and profile_name in vendor_file['public_clouds']:
_auth_update(cloud, vendor_file['public_clouds'][profile_name])
else: