diff options
-rw-r--r-- | os_client_config/cloud_config.py | 4 | ||||
-rw-r--r-- | os_client_config/config.py | 45 | ||||
-rw-r--r-- | releasenotes/source/conf.py | 3 |
3 files changed, 27 insertions, 25 deletions
diff --git a/os_client_config/cloud_config.py b/os_client_config/cloud_config.py index a911d81..147eb04 100644 --- a/os_client_config/cloud_config.py +++ b/os_client_config/cloud_config.py @@ -103,6 +103,10 @@ class CloudConfig(object): def __ne__(self, other): return not self == other + def set_session_constructor(self, session_constructor): + """Sets the Session constructor.""" + self._session_constructor = session_constructor + def get_requests_verify_args(self): """Return the verify and cert values for the requests library.""" if self.config['verify'] and self.config['cacert']: diff --git a/os_client_config/config.py b/os_client_config/config.py index 01f659e..6ff2359 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): @@ -1035,24 +1034,6 @@ class OpenStackConfig(object): return config - def load_auth_plugin(self, config, cloud): - try: - loader = self._get_auth_loader(config) - config = self._validate_auth(config, loader) - auth_plugin = loader.load_from_options(**config['auth']) - except Exception as e: - # We WANT the ksa exception normally - # but OSC can't handle it right now, so we try deferring - # to ksc. If that ALSO fails, it means there is likely - # a deeper issue, so we assume the ksa error was correct - self.log.debug("Deferring keystone exception: {e}".format(e=e)) - auth_plugin = None - try: - config = self._validate_auth_ksc(config, cloud) - except Exception: - raise e - return auth_plugin - def get_one_cloud(self, cloud=None, validate=True, argparse=None, **kwargs): """Retrieve a single cloud configuration and merge additional options @@ -1111,7 +1092,21 @@ class OpenStackConfig(object): config = self.auth_config_hook(config) if validate: - auth_plugin = self.load_auth_plugin(config, cloud) + try: + loader = self._get_auth_loader(config) + config = self._validate_auth(config, loader) + auth_plugin = loader.load_from_options(**config['auth']) + except Exception as e: + # We WANT the ksa exception normally + # but OSC can't handle it right now, so we try deferring + # to ksc. If that ALSO fails, it means there is likely + # a deeper issue, so we assume the ksa error was correct + self.log.debug("Deferring keystone exception: {e}".format(e=e)) + auth_plugin = None + try: + config = self._validate_auth_ksc(config, cloud) + except Exception: + raise e else: auth_plugin = None diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 282dbd7..e33ee8e 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -259,3 +259,6 @@ texinfo_documents = [ # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False + +# -- Options for Internationalization output ------------------------------ +locale_dirs = ['locale/'] |