Include OSC additions 2

OSC has some additions to OSC_Config that we need to include:
* Updates to initialize_app() and prepare_to_run_command()

Change-Id: I1846f823fb57bb0b43c0f074a24d3de1a8e4a24f
This commit is contained in:
Dean Troyer 2017-01-04 11:32:22 -06:00
parent 3fdc5b16e4
commit 52e7aa6fdd

View File

@ -390,9 +390,13 @@ class OpenStackShell(app.App):
# can be set to None. # can be set to None.
if not self.options.debug: if not self.options.debug:
self.options.debug = None self.options.debug = None
# NOTE(dtroyer): Need to do this with validate=False to defer the
# auth plugin handling to ClientManager.setup_auth()
self.cloud = cc.get_one_cloud( self.cloud = cc.get_one_cloud(
cloud=self.options.cloud, cloud=self.options.cloud,
argparse=self.options, argparse=self.options,
validate=False,
) )
self.log_configurator.configure(self.cloud) self.log_configurator.configure(self.cloud)
@ -425,6 +429,25 @@ class OpenStackShell(app.App):
cmd.__class__.__module__, cmd.__class__.__module__,
cmd.__class__.__name__, cmd.__class__.__name__,
) )
kwargs = {}
if not cmd.auth_required:
# Build fake token creds to keep ksa and o-c-c hushed
kwargs['auth_type'] = 'token_endpoint'
kwargs['auth'] = {}
kwargs['auth']['token'] = 'x'
kwargs['auth']['url'] = 'x'
# Validate auth options
self.cloud = self.cloud_config.get_one_cloud(
cloud=self.options.cloud,
argparse=self.options,
validate=True,
**kwargs
)
# Push the updated args into ClientManager
self.client_manager._cli_options = self.cloud
if cmd.auth_required: if cmd.auth_required:
self.client_manager.setup_auth() self.client_manager.setup_auth()
if hasattr(cmd, 'required_scope') and cmd.required_scope: if hasattr(cmd, 'required_scope') and cmd.required_scope: