Enable Keystone v3 API when obtaining users and tenants
Always use Keystone v3 API obtaining users and projects in order to list all users and tenants in multi-domain environments. Change-Id: If94ad4a0d61d0467031b384d132eb433682b3a20 Closes-Bug: #1662142
This commit is contained in:
parent
3a2c9ce002
commit
bc797dfb4b
|
@ -169,12 +169,11 @@ class CollectdPlugin(base.Base):
|
|||
|
||||
def _build_url(self, service, resource):
|
||||
s = (self.get_service(service) or {})
|
||||
# the adminURL must be used to access resources with Keystone API v2
|
||||
if service == 'keystone' and \
|
||||
(resource in ['tenants', 'users'] or 'OS-KS' in resource):
|
||||
url = s.get('admin_url')
|
||||
else:
|
||||
url = s.get('url')
|
||||
url = s.get('url')
|
||||
# v3 API must be used in order to obtain tenants in multi-domain envs
|
||||
if service == 'keystone' and (resource in ['projects',
|
||||
'users', 'roles']):
|
||||
url = url.replace('v2.0', 'v3')
|
||||
|
||||
if url:
|
||||
if url[-1] != '/':
|
||||
|
|
|
@ -40,11 +40,11 @@ class KeystoneStatsPlugin(openstack.CollectdPlugin):
|
|||
return 'enabled' if d.get('enabled') else 'disabled'
|
||||
|
||||
# tenants
|
||||
r = self.get('keystone', 'tenants')
|
||||
r = self.get('keystone', 'projects')
|
||||
if not r:
|
||||
self.logger.warning('Could not find Keystone tenants')
|
||||
return
|
||||
tenants_details = r.json().get('tenants', [])
|
||||
tenants_details = r.json().get('projects', [])
|
||||
status = self.count_objects_group_by(tenants_details,
|
||||
group_by_func=groupby)
|
||||
for s, nb in status.iteritems():
|
||||
|
@ -70,7 +70,7 @@ class KeystoneStatsPlugin(openstack.CollectdPlugin):
|
|||
}
|
||||
|
||||
# roles
|
||||
r = self.get('keystone', 'OS-KSADM/roles')
|
||||
r = self.get('keystone', 'roles')
|
||||
if not r:
|
||||
self.logger.warning('Could not find Keystone roles')
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue