Merge "Default user domain id and project domain id"
This commit is contained in:
		| @@ -102,6 +102,12 @@ def base_parser(parser): | |||||||
|         default=env('OS_CACERT'), |         default=env('OS_CACERT'), | ||||||
|         help='CA certificate bundle file (Env: OS_CACERT)', |         help='CA certificate bundle file (Env: OS_CACERT)', | ||||||
|     ) |     ) | ||||||
|  |     parser.add_argument( | ||||||
|  |         '--os-default-domain', | ||||||
|  |         metavar='<auth-domain>', | ||||||
|  |         default='default', | ||||||
|  |         help='Default domain ID, default=default (Env: OS_DEFAULT_DOMAIN)', | ||||||
|  |     ) | ||||||
|     verify_group = parser.add_mutually_exclusive_group() |     verify_group = parser.add_mutually_exclusive_group() | ||||||
|     verify_group.add_argument( |     verify_group.add_argument( | ||||||
|         '--verify', |         '--verify', | ||||||
|   | |||||||
| @@ -98,6 +98,23 @@ class ClientManager(object): | |||||||
|         self._auth_ref = None |         self._auth_ref = None | ||||||
|         self.timing = auth_options.timing |         self.timing = auth_options.timing | ||||||
|  |  | ||||||
|  |         default_domain = auth_options.os_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 (self._api_version.get('identity') == '3' and | ||||||
|  |             not self._auth_params.get('project_domain_id') and | ||||||
|  |                 not self._auth_params.get('project_domain_name')): | ||||||
|  |             self._auth_params['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. | ||||||
|  |         if (self._api_version.get('identity') == '3' and | ||||||
|  |             not self._auth_params.get('user_domain_id') and | ||||||
|  |                 not self._auth_params.get('user_domain_name')): | ||||||
|  |             self._auth_params['user_domain_id'] = default_domain | ||||||
|  |  | ||||||
|         # For compatibility until all clients can be updated |         # For compatibility until all clients can be updated | ||||||
|         if 'project_name' in self._auth_params: |         if 'project_name' in self._auth_params: | ||||||
|             self._project_name = self._auth_params['project_name'] |             self._project_name = self._auth_params['project_name'] | ||||||
|   | |||||||
| @@ -49,6 +49,7 @@ class FakeOptions(object): | |||||||
|         self.timing = None |         self.timing = None | ||||||
|         self.os_region_name = None |         self.os_region_name = None | ||||||
|         self.os_url = None |         self.os_url = None | ||||||
|  |         self.os_default_domain = 'default' | ||||||
|         self.__dict__.update(kwargs) |         self.__dict__.update(kwargs) | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jenkins
					Jenkins