summaryrefslogtreecommitdiff
path: root/openstackclient/shell.py
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2016-08-16 09:41:31 -0500
committerDean Troyer <dtroyer@gmail.com>2016-08-18 07:21:15 -0500
commit2a1a1740862c419e08284e50103d52e029f0e61e (patch)
tree0c79d7ee85cef51359af828580a345f8361e2b71 /openstackclient/shell.py
parent0b91368164acc596bf97fe4073083e26892f5b1a (diff)
downloadpython-openstackclient-2a1a1740862c419e08284e50103d52e029f0e61e.tar.gz
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 <s.martinelli@gmail.com> Depends-On: I49313dc7d4f44ec897de7a375f25b7ed864226f1 Change-Id: I426548376fc7d3cdb36501310dafd8c44d22ae30
Diffstat (limited to 'openstackclient/shell.py')
-rw-r--r--openstackclient/shell.py31
1 files changed, 28 insertions, 3 deletions
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,