diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-08-18 17:52:37 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-08-18 17:52:37 +0000 |
| commit | 34f5515a329d7bdd9b945e256729cd4c97595201 (patch) | |
| tree | 27a08c2a735e8d432319a9ebcd664c3191520689 /openstackclient/shell.py | |
| parent | fc7a69e410f217a436f7dae97b35314019a48b1b (diff) | |
| parent | 2a1a1740862c419e08284e50103d52e029f0e61e (diff) | |
| download | python-openstackclient-34f5515a329d7bdd9b945e256729cd4c97595201.tar.gz | |
Merge "Gate-unbreaking combo review"
Diffstat (limited to 'openstackclient/shell.py')
| -rw-r--r-- | openstackclient/shell.py | 31 |
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, |
