summaryrefslogtreecommitdiff
path: root/openstackclient/common
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2017-02-01 17:36:13 -0600
committerSteve Martinelli <s.martinelli@gmail.com>2017-02-20 17:35:42 +0000
commit0719348ba1abd0386fafff882d04720b92ea3631 (patch)
tree0c3ac2fc3d2d5787e886b6c203649c21309e103c /openstackclient/common
parent1e3faf9f64f36df351a15bd444d3024d9a7beeff (diff)
downloadpython-openstackclient-0719348ba1abd0386fafff882d04720b92ea3631.tar.gz
TODO cleanup: osc-lib
osc-lib 1.3.0 is released, which contains these functions that still need to be migrated all the way down to os-client-config. Currently osc-lib 1.2.0 is in global-requirements so this can not be merged yet, but is included here for testing and to be ready for when g-r is unfrozen. Change-Id: I7bc8ed6cf78f38bab4a718ed3e2a88641fa23f27
Diffstat (limited to 'openstackclient/common')
-rw-r--r--openstackclient/common/client_config.py68
1 files changed, 0 insertions, 68 deletions
diff --git a/openstackclient/common/client_config.py b/openstackclient/common/client_config.py
index 5e139596..a22dd0cb 100644
--- a/openstackclient/common/client_config.py
+++ b/openstackclient/common/client_config.py
@@ -13,7 +13,6 @@
"""OpenStackConfig subclass for argument compatibility"""
-from os_client_config import exceptions as occ_exceptions
from osc_lib.cli import client_config
@@ -70,70 +69,3 @@ class OSC_Config(client_config.OSC_Config):
config = self._validate_auth(config, loader)
auth_plugin = loader.load_from_options(**config['auth'])
return auth_plugin
-
- # TODO(dtroyer): Remove _validate_auth_ksc when it is in osc-lib 1.3.0
- def _validate_auth_ksc(self, config, cloud, fixed_argparse=None):
- """Old compatibility hack for OSC, no longer needed/wanted"""
- return config
-
- # TODO(dtroyer): Remove _validate_auth when it is in osc-lib 1.3.0
- def _validate_auth(self, config, loader, fixed_argparse=None):
- """Validate auth plugin arguments"""
- # May throw a keystoneauth1.exceptions.NoMatchingPlugin
-
- plugin_options = loader.get_options()
-
- msgs = []
- prompt_options = []
- for p_opt in plugin_options:
- # if it's in config, win, move it and kill it from config dict
- # if it's in config.auth but not in config we're good
- # deprecated loses to current
- # provided beats default, deprecated or not
- winning_value = self._find_winning_auth_value(p_opt, config)
- if not winning_value:
- winning_value = self._find_winning_auth_value(
- p_opt, config['auth'])
-
- # if the plugin tells us that this value is required
- # then error if it's doesn't exist now
- if not winning_value and p_opt.required:
- msgs.append(
- 'Missing value {auth_key}'
- ' required for auth plugin {plugin}'.format(
- auth_key=p_opt.name, plugin=config.get('auth_type'),
- )
- )
-
- # Clean up after ourselves
- for opt in [p_opt.name] + [o.name for o in p_opt.deprecated]:
- opt = opt.replace('-', '_')
- config.pop(opt, None)
- config['auth'].pop(opt, None)
-
- if winning_value:
- # Prefer the plugin configuration dest value if the value's key
- # is marked as depreciated.
- if p_opt.dest is None:
- config['auth'][p_opt.name.replace('-', '_')] = (
- winning_value)
- else:
- config['auth'][p_opt.dest] = winning_value
-
- # See if this needs a prompting
- if (
- 'prompt' in vars(p_opt) and
- p_opt.prompt is not None and
- p_opt.dest not in config['auth'] and
- self._pw_callback is not None
- ):
- # Defer these until we know all required opts are present
- prompt_options.append(p_opt)
-
- if msgs:
- raise occ_exceptions.OpenStackConfigException('\n'.join(msgs))
- else:
- for p_opt in prompt_options:
- config['auth'][p_opt.dest] = self._pw_callback(p_opt.prompt)
-
- return config