From 5a4f809caf2223121803debab2e6ac52bc943116 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 27 May 2015 08:46:21 -0400 Subject: 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 --- os_client_config/config.py | 7 ++++--- 1 file 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: -- cgit v1.2.1