Set id for services in catalog
currently enabling audit middleware results in every request producing warning in the log 'Invalid uuid: ' from pycadf, due to audit middleware not being able find a uuid to set as a service/target id because auth_token middleware no longer does not pass ids of the endpoints to the catalog it sets on request. This patch adds service id to the catalog being set by auth_token, and uses it in audit middleware too. This will hopefully not dramatically increase the size of the catalog. Change-Id: I8417bd29b129f4afdd8b43e4f74ea126ee8fae4f Closes-Bug: #2015334
This commit is contained in:
parent
92cdf8a0a5
commit
7c6714f186
|
@ -196,7 +196,7 @@ class OpenStackAuditApi(object):
|
||||||
endp['type'],
|
endp['type'],
|
||||||
taxonomy.UNKNOWN),
|
taxonomy.UNKNOWN),
|
||||||
name=endp['name'],
|
name=endp['name'],
|
||||||
id=endp['endpoints'][0].get('id', endp['name']),
|
id=endp.get('id', endp['name']),
|
||||||
admin_endp=endpoint.Endpoint(
|
admin_endp=endpoint.Endpoint(
|
||||||
name='admin',
|
name='admin',
|
||||||
url=endp['endpoints'][0].get('adminURL', taxonomy.UNKNOWN)),
|
url=endp['endpoints'][0].get('adminURL', taxonomy.UNKNOWN)),
|
||||||
|
|
|
@ -24,6 +24,7 @@ def _normalize_catalog(catalog):
|
||||||
service = {'type': v3_service['type']}
|
service = {'type': v3_service['type']}
|
||||||
try:
|
try:
|
||||||
service['name'] = v3_service['name']
|
service['name'] = v3_service['name']
|
||||||
|
service['id'] = v3_service['id']
|
||||||
except KeyError: # nosec
|
except KeyError: # nosec
|
||||||
# v3 service doesn't have a name, move on.
|
# v3 service doesn't have a name, move on.
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -78,6 +78,7 @@ class BaseAuditMiddlewareTest(utils.MiddlewareTestCase):
|
||||||
"internalURL":
|
"internalURL":
|
||||||
"http://internal_host:8774",
|
"http://internal_host:8774",
|
||||||
"id": "resource_id"}],
|
"id": "resource_id"}],
|
||||||
|
"id": "resource_id",
|
||||||
"type": "compute",
|
"type": "compute",
|
||||||
"name": "nova"}]''',
|
"name": "nova"}]''',
|
||||||
'HTTP_X_USER_ID': 'user_id',
|
'HTTP_X_USER_ID': 'user_id',
|
||||||
|
|
Loading…
Reference in New Issue