File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,6 +102,12 @@ def base_parser(parser):
102102 default = env ('OS_CACERT' ),
103103 help = 'CA certificate bundle file (Env: OS_CACERT)' ,
104104 )
105+ parser .add_argument (
106+ '--os-default-domain' ,
107+ metavar = '<auth-domain>' ,
108+ default = 'default' ,
109+ help = 'Default domain ID, default=default (Env: OS_DEFAULT_DOMAIN)' ,
110+ )
105111 verify_group = parser .add_mutually_exclusive_group ()
106112 verify_group .add_argument (
107113 '--verify' ,
Original file line number Diff line number Diff line change @@ -98,6 +98,23 @@ def __init__(
9898 self ._auth_ref = None
9999 self .timing = auth_options .timing
100100
101+ default_domain = auth_options .os_default_domain
102+ # NOTE(stevemar): If PROJECT_DOMAIN_ID or PROJECT_DOMAIN_NAME is
103+ # present, then do not change the behaviour. Otherwise, set the
104+ # PROJECT_DOMAIN_ID to 'OS_DEFAULT_DOMAIN' for better usability.
105+ if (self ._api_version .get ('identity' ) == '3' and
106+ not self ._auth_params .get ('project_domain_id' ) and
107+ not self ._auth_params .get ('project_domain_name' )):
108+ self ._auth_params ['project_domain_id' ] = default_domain
109+
110+ # NOTE(stevemar): If USER_DOMAIN_ID or USER_DOMAIN_NAME is present,
111+ # then do not change the behaviour. Otherwise, set the USER_DOMAIN_ID
112+ # to 'OS_DEFAULT_DOMAIN' for better usability.
113+ if (self ._api_version .get ('identity' ) == '3' and
114+ not self ._auth_params .get ('user_domain_id' ) and
115+ not self ._auth_params .get ('user_domain_name' )):
116+ self ._auth_params ['user_domain_id' ] = default_domain
117+
101118 # For compatibility until all clients can be updated
102119 if 'project_name' in self ._auth_params :
103120 self ._project_name = self ._auth_params ['project_name' ]
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ def __init__(self, **kwargs):
4949 self .timing = None
5050 self .os_region_name = None
5151 self .os_url = None
52+ self .os_default_domain = 'default'
5253 self .__dict__ .update (kwargs )
5354
5455
You can’t perform that action at this time.
0 commit comments