Skip to content

Commit 0719348

Browse files
Dean Troyerstevemar
authored andcommitted
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
1 parent 1e3faf9 commit 0719348

1 file changed

Lines changed: 0 additions & 68 deletions

File tree

openstackclient/common/client_config.py

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
"""OpenStackConfig subclass for argument compatibility"""
1515

16-
from os_client_config import exceptions as occ_exceptions
1716
from osc_lib.cli import client_config
1817

1918

@@ -70,70 +69,3 @@ def load_auth_plugin(self, config):
7069
config = self._validate_auth(config, loader)
7170
auth_plugin = loader.load_from_options(**config['auth'])
7271
return auth_plugin
73-
74-
# TODO(dtroyer): Remove _validate_auth_ksc when it is in osc-lib 1.3.0
75-
def _validate_auth_ksc(self, config, cloud, fixed_argparse=None):
76-
"""Old compatibility hack for OSC, no longer needed/wanted"""
77-
return config
78-
79-
# TODO(dtroyer): Remove _validate_auth when it is in osc-lib 1.3.0
80-
def _validate_auth(self, config, loader, fixed_argparse=None):
81-
"""Validate auth plugin arguments"""
82-
# May throw a keystoneauth1.exceptions.NoMatchingPlugin
83-
84-
plugin_options = loader.get_options()
85-
86-
msgs = []
87-
prompt_options = []
88-
for p_opt in plugin_options:
89-
# if it's in config, win, move it and kill it from config dict
90-
# if it's in config.auth but not in config we're good
91-
# deprecated loses to current
92-
# provided beats default, deprecated or not
93-
winning_value = self._find_winning_auth_value(p_opt, config)
94-
if not winning_value:
95-
winning_value = self._find_winning_auth_value(
96-
p_opt, config['auth'])
97-
98-
# if the plugin tells us that this value is required
99-
# then error if it's doesn't exist now
100-
if not winning_value and p_opt.required:
101-
msgs.append(
102-
'Missing value {auth_key}'
103-
' required for auth plugin {plugin}'.format(
104-
auth_key=p_opt.name, plugin=config.get('auth_type'),
105-
)
106-
)
107-
108-
# Clean up after ourselves
109-
for opt in [p_opt.name] + [o.name for o in p_opt.deprecated]:
110-
opt = opt.replace('-', '_')
111-
config.pop(opt, None)
112-
config['auth'].pop(opt, None)
113-
114-
if winning_value:
115-
# Prefer the plugin configuration dest value if the value's key
116-
# is marked as depreciated.
117-
if p_opt.dest is None:
118-
config['auth'][p_opt.name.replace('-', '_')] = (
119-
winning_value)
120-
else:
121-
config['auth'][p_opt.dest] = winning_value
122-
123-
# See if this needs a prompting
124-
if (
125-
'prompt' in vars(p_opt) and
126-
p_opt.prompt is not None and
127-
p_opt.dest not in config['auth'] and
128-
self._pw_callback is not None
129-
):
130-
# Defer these until we know all required opts are present
131-
prompt_options.append(p_opt)
132-
133-
if msgs:
134-
raise occ_exceptions.OpenStackConfigException('\n'.join(msgs))
135-
else:
136-
for p_opt in prompt_options:
137-
config['auth'][p_opt.dest] = self._pw_callback(p_opt.prompt)
138-
139-
return config

0 commit comments

Comments
 (0)