@@ -80,21 +80,21 @@ def select_auth_plugin(options):
8080 # Do the token/url check first as this must override the default
8181 # 'password' set by os-client-config
8282 # Also, url and token are not copied into o-c-c's auth dict (yet?)
83- if options .auth .get ('url' , None ) and options .auth .get ('token' , None ):
83+ if options .auth .get ('url' ) and options .auth .get ('token' ):
8484 # service token authentication
8585 auth_plugin_name = 'token_endpoint'
8686 elif options .auth_type in [plugin .name for plugin in PLUGIN_LIST ]:
8787 # A direct plugin name was given, use it
8888 auth_plugin_name = options .auth_type
89- elif options .auth .get ('username' , None ):
89+ elif options .auth .get ('username' ):
9090 if options .identity_api_version == '3' :
9191 auth_plugin_name = 'v3password'
9292 elif options .identity_api_version .startswith ('2' ):
9393 auth_plugin_name = 'v2password'
9494 else :
9595 # let keystoneclient figure it out itself
9696 auth_plugin_name = 'osc_password'
97- elif options .auth .get ('token' , None ):
97+ elif options .auth .get ('token' ):
9898 if options .identity_api_version == '3' :
9999 auth_plugin_name = 'v3token'
100100 elif options .identity_api_version .startswith ('2' ):
@@ -144,33 +144,33 @@ def check_valid_auth_options(options, auth_plugin_name, required_scope=True):
144144
145145 msg = ''
146146 if auth_plugin_name .endswith ('password' ):
147- if not options .auth .get ('username' , None ):
147+ if not options .auth .get ('username' ):
148148 msg += _ ('Set a username with --os-username, OS_USERNAME,'
149149 ' or auth.username\n ' )
150- if not options .auth .get ('auth_url' , None ):
150+ if not options .auth .get ('auth_url' ):
151151 msg += _ ('Set an authentication URL, with --os-auth-url,'
152152 ' OS_AUTH_URL or auth.auth_url\n ' )
153153 if (required_scope and not
154- options .auth .get ('project_id' , None ) and not
155- options .auth .get ('domain_id' , None ) and not
156- options .auth .get ('domain_name' , None ) and not
157- options .auth .get ('project_name' , None ) and not
158- options .auth .get ('tenant_id' , None ) and not
159- options .auth .get ('tenant_name' , None )):
154+ options .auth .get ('project_id' ) and not
155+ options .auth .get ('domain_id' ) and not
156+ options .auth .get ('domain_name' ) and not
157+ options .auth .get ('project_name' ) and not
158+ options .auth .get ('tenant_id' ) and not
159+ options .auth .get ('tenant_name' )):
160160 msg += _ ('Set a scope, such as a project or domain, set a '
161161 'project scope with --os-project-name, OS_PROJECT_NAME '
162162 'or auth.project_name, set a domain scope with '
163163 '--os-domain-name, OS_DOMAIN_NAME or auth.domain_name' )
164164 elif auth_plugin_name .endswith ('token' ):
165- if not options .auth .get ('token' , None ):
165+ if not options .auth .get ('token' ):
166166 msg += _ ('Set a token with --os-token, OS_TOKEN or auth.token\n ' )
167- if not options .auth .get ('auth_url' , None ):
167+ if not options .auth .get ('auth_url' ):
168168 msg += _ ('Set a service AUTH_URL, with --os-auth-url, '
169169 'OS_AUTH_URL or auth.auth_url\n ' )
170170 elif auth_plugin_name == 'token_endpoint' :
171- if not options .auth .get ('token' , None ):
171+ if not options .auth .get ('token' ):
172172 msg += _ ('Set a token with --os-token, OS_TOKEN or auth.token\n ' )
173- if not options .auth .get ('url' , None ):
173+ if not options .auth .get ('url' ):
174174 msg += _ ('Set a service URL, with --os-url, OS_URL or auth.url\n ' )
175175
176176 if msg :
0 commit comments