diff options
-rw-r--r-- | os_client_config/config.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/os_client_config/config.py b/os_client_config/config.py index 5b8c53a..56992df 100644 --- a/os_client_config/config.py +++ b/os_client_config/config.py @@ -56,6 +56,7 @@ class OpenStackConfig(object): defaults.add('insecure') defaults.add('endpoint_type') defaults.add('cacert') + defaults.add('auth_type') self.defaults = defaults @@ -75,7 +76,11 @@ class OpenStackConfig(object): return yaml.load(open(path, 'r')) def _get_regions(self, cloud): - return self.cloud_config['clouds'][cloud]['region_name'] + try: + return self.cloud_config['clouds'][cloud]['region_name'] + except KeyError: + # No region configured + return '' def _get_region(self, cloud): return self._get_regions(cloud).split(',')[0] @@ -90,6 +95,9 @@ class OpenStackConfig(object): else: our_cloud = dict() + # Get the defaults (including env vars) first + cloud.update(self.defaults) + # yes, I know the next line looks silly if 'cloud' in our_cloud: try: @@ -98,7 +106,6 @@ class OpenStackConfig(object): # Can't find the requested vendor config, go about business pass - cloud.update(self.defaults) cloud.update(our_cloud) if 'cloud' in cloud: del cloud['cloud'] |