summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/common/client_config.py71
-rw-r--r--openstackclient/shell.py33
2 files changed, 1 insertions, 103 deletions
diff --git a/openstackclient/common/client_config.py b/openstackclient/common/client_config.py
deleted file mode 100644
index a22dd0cb..00000000
--- a/openstackclient/common/client_config.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-
-"""OpenStackConfig subclass for argument compatibility"""
-
-from osc_lib.cli import client_config
-
-
-# Sublcass OpenStackConfig in order to munge config values
-# before auth plugins are loaded
-class OSC_Config(client_config.OSC_Config):
-
- # TODO(dtroyer): Remove _auth_default_domain when the v3otp fix is
- # backported to osc-lib, should be in release 1.3.0
- def _auth_default_domain(self, config):
- """Set a default domain from available arguments
-
- Migrated from clientmanager.setup_auth()
- """
-
- identity_version = config.get('identity_api_version', '')
- auth_type = config.get('auth_type', None)
-
- # TODO(mordred): This is a usability improvement that's broadly useful
- # We should port it back up into os-client-config.
- default_domain = config.get('default_domain', None)
- if (identity_version == '3' and
- not auth_type.startswith('v2') and
- default_domain):
-
- # NOTE(stevemar): If PROJECT_DOMAIN_ID or PROJECT_DOMAIN_NAME is
- # present, then do not change the behaviour. Otherwise, set the
- # PROJECT_DOMAIN_ID to 'OS_DEFAULT_DOMAIN' for better usability.
- if (
- auth_type in ("password", "v3password", "v3totp") and
- not config['auth'].get('project_domain_id') and
- not config['auth'].get('project_domain_name')
- ):
- config['auth']['project_domain_id'] = default_domain
-
- # NOTE(stevemar): If USER_DOMAIN_ID or USER_DOMAIN_NAME is present,
- # then do not change the behaviour. Otherwise, set the
- # USER_DOMAIN_ID to 'OS_DEFAULT_DOMAIN' for better usability.
- # NOTE(aloga): this should only be set if there is a username.
- # TODO(dtroyer): Move this to os-client-config after the plugin has
- # been loaded so we can check directly if the options are accepted.
- if (
- auth_type in ("password", "v3password", "v3totp") and
- not config['auth'].get('user_domain_id') and
- not config['auth'].get('user_domain_name')
- ):
- config['auth']['user_domain_id'] = default_domain
- return config
-
- def load_auth_plugin(self, config):
- """Get auth plugin and validate args"""
-
- loader = self._get_auth_loader(config)
- config = self._validate_auth(config, loader)
- auth_plugin = loader.load_from_options(**config['auth'])
- return auth_plugin
diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index 4489219f..7fbda1ae 100644
--- a/openstackclient/shell.py
+++ b/openstackclient/shell.py
@@ -25,7 +25,6 @@ from osc_lib import shell
import six
import openstackclient
-from openstackclient.common import client_config as cloud_config
from openstackclient.common import clientmanager
@@ -133,37 +132,7 @@ class OpenStackShell(shell.OpenStackShell):
def initialize_app(self, argv):
super(OpenStackShell, self).initialize_app(argv)
- # 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:
- self.cloud_config = cloud_config.OSC_Config(
- override_defaults={
- 'interface': None,
- 'auth_type': self._auth_type,
- },
- )
- except (IOError, OSError):
- self.log.critical("Could not read clouds.yaml configuration file")
- self.print_help_if_requested()
- raise
-
- 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 = self.cloud_config.get_one_cloud(
- cloud=self.options.cloud,
- argparse=self.options,
- validate=False,
- )
-
- # Then, re-create the client_manager with the correct arguments
+ # Re-create the client_manager with our subclass
self.client_manager = clientmanager.ClientManager(
cli_options=self.cloud,
api_version=self.api_version,