From 2a1a1740862c419e08284e50103d52e029f0e61e Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Tue, 16 Aug 2016 09:41:31 -0500 Subject: Gate-unbreaking combo review Fix argument precedence hack Working around issues in os-client-config <= 1.18.0 This is ugly because the issues in o-c-c 1.19.1 run even deeper than in 1.18.0, so we're going to use 1.19.0 get_one_cloud() that is known to work for OSC and fix o-c-c with an axe. Remove return values for set commands 'identity provider set' and 'service provider set' were still returning their show-like data, this is a fail for set commands now, don't know how this ever passed before... Constraints are ready to be used for tox.ini Per email[1] from Andreas, we don't need to hack at install_command any longer. [1] http://openstack.markmail.org/thread/a4l7tokbotwqvuoh Co-authorioed-by: Steve Martinelli Depends-On: I49313dc7d4f44ec897de7a375f25b7ed864226f1 Change-Id: I426548376fc7d3cdb36501310dafd8c44d22ae30 --- openstackclient/shell.py | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'openstackclient/shell.py') diff --git a/openstackclient/shell.py b/openstackclient/shell.py index 7a042e1e..67c51998 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -25,6 +25,7 @@ from oslo_utils import importutils import six import openstackclient +from openstackclient.common import client_config as cloud_config from openstackclient.common import clientmanager from openstackclient.common import commandmanager @@ -127,9 +128,33 @@ class OpenStackShell(shell.OpenStackShell): def initialize_app(self, argv): super(OpenStackShell, self).initialize_app(argv) - # For now we need to build our own ClientManager so re-do what - # has already been done :( - # TODO(dtroyer): remove when osc-lib is fixed + # Argument precedence is really broken in multiple places + # so we're just going to fix it here until o-c-c and osc-lib + # get sorted out. + # TODO(dtroyer): remove when os-client-config and osc-lib are fixed + + # First, throw away what has already been done with o-c-c and + # use our own. + try: + cc = cloud_config.OSC_Config( + override_defaults={ + 'interface': None, + 'auth_type': self._auth_type, + }, + ) + except (IOError, OSError) as e: + self.log.critical("Could not read clouds.yaml configuration file") + self.print_help_if_requested() + raise e + + if not self.options.debug: + self.options.debug = None + self.cloud = cc.get_one_cloud( + cloud=self.options.cloud, + argparse=self.options, + ) + + # Then, re-create the client_manager with the correct arguments self.client_manager = clientmanager.ClientManager( cli_options=self.cloud, api_version=self.api_version, -- cgit v1.2.1