diff options
author | Jamie Lennox <jamielennox@gmail.com> | 2015-12-02 11:05:29 +0800 |
---|---|---|
committer | Jamie Lennox <jamielennox@gmail.com> | 2015-12-02 11:05:29 +0800 |
commit | 026a17c9eb9d8ebad8c56f8d1b7946bd4694519e (patch) | |
tree | 31d748d781673e48352918fa032f4582a7ebd612 | |
parent | cc92c92870be48d6eae57869c4989125fe2eb8e4 (diff) | |
download | os-client-config-026a17c9eb9d8ebad8c56f8d1b7946bd4694519e.tar.gz |
Remove optional keystoneauth1 imports
keystoneauth1 is now a hard dependency of os-client-config so there is
no way that this should not be importable.
Change-Id: I20901623e8b29f50d7ab1ed956472a4b1eda51bf
-rw-r--r-- | os_client_config/config.py | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/os_client_config/config.py b/os_client_config/config.py index 5f7c402..19cfa35 100644 --- a/os_client_config/config.py +++ b/os_client_config/config.py @@ -18,10 +18,7 @@ import os import warnings import appdirs -try: - from keystoneauth1 import loading -except ImportError: - loading = None +from keystoneauth1 import loading import yaml from os_client_config import cloud_config @@ -657,27 +654,23 @@ class OpenStackConfig(object): # compatible behaviour config = self.auth_config_hook(config) - if loading: - if validate: - 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 - auth_plugin = None - try: - config = self._validate_auth_ksc(config) - except Exception: - raise e - else: + if validate: + 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 auth_plugin = None + try: + config = self._validate_auth_ksc(config) + except Exception: + raise e else: auth_plugin = None - config = self._validate_auth_ksc(config) # If any of the defaults reference other values, we need to expand for (key, value) in config.items(): |