From 52e7aa6fdd1f2de6242dddd0419d1770162d51c3 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Wed, 4 Jan 2017 11:32:22 -0600 Subject: [PATCH] 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 --- osc_lib/shell.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/osc_lib/shell.py b/osc_lib/shell.py index a0f932b..55510ec 100644 --- a/osc_lib/shell.py +++ b/osc_lib/shell.py @@ -390,9 +390,13 @@ class OpenStackShell(app.App): # can be set to None. if not self.options.debug: 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( cloud=self.options.cloud, argparse=self.options, + validate=False, ) self.log_configurator.configure(self.cloud) @@ -425,6 +429,25 @@ class OpenStackShell(app.App): cmd.__class__.__module__, 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: self.client_manager.setup_auth() if hasattr(cmd, 'required_scope') and cmd.required_scope: