Merge "Remove os-client-config hacks for 1.19.x and 1.20.x"

This commit is contained in:
Jenkins 2016-10-27 16:50:38 +00:00 committed by Gerrit Code Review
commit 5482f52612
1 changed files with 0 additions and 76 deletions

View File

@ -151,79 +151,3 @@ class OSC_Config(config.OpenStackConfig):
LOG.debug("auth_config_hook(): %s",
strutils.mask_password(six.text_type(config)))
return config
# TODO(dtroyer): un-hackify all of the below when o-c-c 1.21.x is
# the minimum in global-requirements
def get_one_cloud(self, cloud=None, validate=True,
argparse=None, **kwargs):
# First, save this off for later
self._save_argparse = self._fix_args({}, argparse=argparse)
return super(OSC_Config, self).get_one_cloud(
cloud=cloud,
validate=validate,
argparse=argparse,
**kwargs
)
def _validate_auth_ksc(self, config, cloud, fixed_argparse=None):
"""Old compatibility hack for OSC, no longer needed/wanted"""
return config
def _validate_auth(self, config, loader, fixed_argparse=None):
"""Validate auth plugin arguments"""
# May throw a keystoneauth1.exceptions.NoMatchingPlugin
if fixed_argparse is None:
# This is o-c-c 1.18.x or older, fix up the original options
fixed_argparse = self._save_argparse
plugin_options = loader.get_options()
for p_opt in plugin_options:
# if it's in argparse, it was passed on the command line and wins
# if it's in config.auth, win, kill it from config dict
# if it's in config and not in config.auth, move it
# deprecated loses to current
# provided beats default, deprecated or not
winning_value = self._find_winning_auth_value(
p_opt, fixed_argparse)
if winning_value:
found_in_argparse = True
else:
found_in_argparse = False
winning_value = self._find_winning_auth_value(
p_opt, config['auth'])
if not winning_value:
winning_value = self._find_winning_auth_value(
p_opt, config)
# Clean up after ourselves
for opt in [p_opt.name] + [o.name for o in p_opt.deprecated]:
opt = opt.replace('-', '_')
# don't do this if the value came from argparse, because we
# don't (yet) know if the value in not-auth came from argparse
# overlay or from someone passing in a dict to kwargs
# TODO(mordred) Fix that data path too
if not found_in_argparse:
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
# NOTE(dtroyer): If os-client-config is 1.21.0 or newer it will
# have an option_prompt() method to handle prompts
if 'option_prompt' in self:
# See if this needs a prompting
config = self.option_prompt(config, p_opt)
return config