tenant_id not required with keystone v3
Ceilometer-client requires tenant_id when authenticating with keystone v3. This fix removes this requirement. Change-Id: I36bf3f7a75713976c56dd95b4fd22da4e64d01df Closes-Bug: 1440463
This commit is contained in:
parent
09bfc70de4
commit
803c59fbc7
|
@ -283,8 +283,14 @@ class AuthPlugin(auth.BaseAuthPlugin):
|
|||
"""
|
||||
has_token = self.opts.get('token') or self.opts.get('auth_token')
|
||||
no_auth = has_token and self.opts.get('endpoint')
|
||||
has_tenant = self.opts.get('tenant_id') or self.opts.get('tenant_name')
|
||||
has_credential = (self.opts.get('username') and has_tenant
|
||||
has_project_domain_or_tenant = (self.opts.get('project_id') or
|
||||
(self.opts.get('project_name') and
|
||||
(self.opts.get('user_domain_name') or
|
||||
self.opts.get('user_domain_id'))) or
|
||||
(self.opts.get('tenant_id') or
|
||||
self.opts.get('tenant_name')))
|
||||
has_credential = (self.opts.get('username')
|
||||
and has_project_domain_or_tenant
|
||||
and self.opts.get('password')
|
||||
and self.opts.get('auth_url'))
|
||||
missing = not (no_auth or has_credential)
|
||||
|
|
|
@ -228,12 +228,6 @@ class CeilometerShell(object):
|
|||
"--os-user-domain-id or via "
|
||||
"env[OS_USER_DOMAIN_ID]")
|
||||
|
||||
if not (self.auth_plugin.opts['tenant_id']
|
||||
or self.auth_plugin.opts['tenant_name']):
|
||||
raise exc.CommandError("You must provide a tenant_id via "
|
||||
"either --os-tenant-id or via "
|
||||
"env[OS_TENANT_ID]")
|
||||
|
||||
if not self.auth_plugin.opts['auth_url']:
|
||||
raise exc.CommandError("You must provide an auth url via "
|
||||
"either --os-auth-url or via "
|
||||
|
|
|
@ -140,7 +140,8 @@ class ShellKeystoneV2Test(ShellTestBase):
|
|||
class ShellKeystoneV3Test(ShellTestBase):
|
||||
|
||||
@mock.patch.object(ks_session, 'Session')
|
||||
def test_debug_switch_raises_error(self, mock_ksclient):
|
||||
@mock.patch('ceilometerclient.client.AuthPlugin.redirect_to_aodh_endpoint')
|
||||
def test_debug_switch_raises_error(self, aodh_redirect, mock_ksclient):
|
||||
mock_ksclient.side_effect = exc.HTTPUnauthorized
|
||||
self.make_env(FAKE_V3_ENV)
|
||||
args = ['--debug', 'event-list']
|
||||
|
|
Loading…
Reference in New Issue