Merge "Set tenant options on parsed namespace"
This commit is contained in:
		@@ -149,7 +149,9 @@ def check_valid_auth_options(options, auth_plugin_name):
 | 
			
		||||
        if (not options.auth.get('project_id', None) and not
 | 
			
		||||
                options.auth.get('domain_id', None) and not
 | 
			
		||||
                options.auth.get('domain_name', None) and not
 | 
			
		||||
                options.auth.get('project_name', None)):
 | 
			
		||||
                options.auth.get('project_name', None) and not
 | 
			
		||||
                options.auth.get('tenant_id', None) and not
 | 
			
		||||
                options.auth.get('tenant_name', None)):
 | 
			
		||||
            msg += _('Set a scope, such as a project or domain, with '
 | 
			
		||||
                     '--os-project-name, OS_PROJECT_NAME or auth.project_name')
 | 
			
		||||
    elif auth_plugin_name.endswith('token'):
 | 
			
		||||
 
 | 
			
		||||
@@ -139,6 +139,7 @@ class ClientManager(object):
 | 
			
		||||
        # PROJECT_DOMAIN_ID to 'OS_DEFAULT_DOMAIN' for better usability.
 | 
			
		||||
        if (self._api_version.get('identity') == '3' and
 | 
			
		||||
            not self._auth_params.get('project_domain_id', None) and
 | 
			
		||||
            not self.auth_plugin_name.startswith('v2') and
 | 
			
		||||
                not self._auth_params.get('project_domain_name', None)):
 | 
			
		||||
            self._auth_params['project_domain_id'] = default_domain
 | 
			
		||||
 | 
			
		||||
@@ -147,6 +148,7 @@ class ClientManager(object):
 | 
			
		||||
        # to 'OS_DEFAULT_DOMAIN' for better usability.
 | 
			
		||||
        if (self._api_version.get('identity') == '3' and
 | 
			
		||||
            self.auth_plugin_name.endswith('password') and
 | 
			
		||||
            not self.auth_plugin_name.startswith('v2') and
 | 
			
		||||
            not self._auth_params.get('user_domain_id', None) and
 | 
			
		||||
                not self._auth_params.get('user_domain_name', None)):
 | 
			
		||||
            self._auth_params['user_domain_id'] = default_domain
 | 
			
		||||
 
 | 
			
		||||
@@ -234,6 +234,23 @@ class OpenStackShell(app.App):
 | 
			
		||||
            cloud_config.set_default('auth_type', 'osc_password')
 | 
			
		||||
        self.log.debug("options: %s", self.options)
 | 
			
		||||
 | 
			
		||||
        project_id = getattr(self.options, 'project_id', None)
 | 
			
		||||
        project_name = getattr(self.options, 'project_name', None)
 | 
			
		||||
        tenant_id = getattr(self.options, 'tenant_id', None)
 | 
			
		||||
        tenant_name = getattr(self.options, 'tenant_name', None)
 | 
			
		||||
 | 
			
		||||
        # handle some v2/v3 authentication inconsistencies by just acting like
 | 
			
		||||
        # both the project and tenant information are both present. This can
 | 
			
		||||
        # go away if we stop registering all the argparse options together.
 | 
			
		||||
        if project_id and not tenant_id:
 | 
			
		||||
            self.options.tenant_id = project_id
 | 
			
		||||
        if project_name and not tenant_name:
 | 
			
		||||
            self.options.tenant_name = project_name
 | 
			
		||||
        if tenant_id and not project_id:
 | 
			
		||||
            self.options.project_id = tenant_id
 | 
			
		||||
        if tenant_name and not project_name:
 | 
			
		||||
            self.options.project_name = tenant_name
 | 
			
		||||
 | 
			
		||||
        # Do configuration file handling
 | 
			
		||||
        cc = cloud_config.OpenStackConfig()
 | 
			
		||||
        self.log.debug("defaults: %s", cc.defaults)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user