drop use of norm_ns
we shouldn't be modifying id as it makes it very difficult to track whether it's prefix or not. as the id is not generated by pycadf it shouldn't be modified by it. Change-Id: I8de3f83af2446402b003212a2cb71bd40d626d28 Partial-Bug: #1504889
This commit is contained in:
parent
ab92a8b2a9
commit
dcd0981d0a
@ -204,8 +204,7 @@ class OpenStackAuditApi(object):
|
||||
endp['type'],
|
||||
taxonomy.UNKNOWN),
|
||||
name=endp['name'],
|
||||
id=identifier.norm_ns(endp['endpoints'][0].get('id',
|
||||
endp['name'])),
|
||||
id=endp['endpoints'][0].get('id', endp['name']),
|
||||
admin_endp=endpoint.Endpoint(
|
||||
name='admin',
|
||||
url=endp['endpoints'][0].get('adminURL', taxonomy.UNKNOWN)),
|
||||
@ -366,13 +365,13 @@ class AuditMiddleware(object):
|
||||
|
||||
initiator = ClientResource(
|
||||
typeURI=taxonomy.ACCOUNT_USER,
|
||||
id=identifier.norm_ns(str(req.environ['HTTP_X_USER_ID'])),
|
||||
id=req.environ['HTTP_X_USER_ID'],
|
||||
name=req.environ['HTTP_X_USER_NAME'],
|
||||
host=host.Host(address=req.client_addr, agent=req.user_agent),
|
||||
credential=KeystoneCredential(
|
||||
token=req.environ['HTTP_X_AUTH_TOKEN'],
|
||||
identity_status=req.environ['HTTP_X_IDENTITY_STATUS']),
|
||||
project_id=identifier.norm_ns(req.environ['HTTP_X_PROJECT_ID']))
|
||||
project_id=req.environ['HTTP_X_PROJECT_ID'])
|
||||
target = self._cadf_audit.get_target_resource(req)
|
||||
|
||||
event = factory.EventFactory().new_event(
|
||||
|
@ -17,7 +17,6 @@ import uuid
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from pycadf import identifier
|
||||
from testtools import matchers
|
||||
import webob
|
||||
|
||||
@ -255,17 +254,17 @@ class AuditApiLogicTest(BaseAuditMiddlewareTest):
|
||||
self.assertEqual(payload['outcome'], 'pending')
|
||||
self.assertEqual(payload['eventType'], 'activity')
|
||||
self.assertEqual(payload['target']['name'], 'nova')
|
||||
self.assertEqual(payload['target']['id'], 'openstack:resource_id')
|
||||
self.assertEqual(payload['target']['id'], 'resource_id')
|
||||
self.assertEqual(payload['target']['typeURI'],
|
||||
'service/compute/servers')
|
||||
self.assertEqual(len(payload['target']['addresses']), 3)
|
||||
self.assertEqual(payload['target']['addresses'][0]['name'], 'admin')
|
||||
self.assertEqual(payload['target']['addresses'][0]['url'],
|
||||
'http://admin_host:8774')
|
||||
self.assertEqual(payload['initiator']['id'], 'openstack:user_id')
|
||||
self.assertEqual(payload['initiator']['id'], 'user_id')
|
||||
self.assertEqual(payload['initiator']['name'], 'user_name')
|
||||
self.assertEqual(payload['initiator']['project_id'],
|
||||
'openstack:tenant_id')
|
||||
'tenant_id')
|
||||
self.assertEqual(payload['initiator']['host']['address'],
|
||||
'192.168.0.1')
|
||||
self.assertEqual(payload['initiator']['typeURI'],
|
||||
@ -318,7 +317,7 @@ class AuditApiLogicTest(BaseAuditMiddlewareTest):
|
||||
self.assertEqual(payload['action'], 'read/list')
|
||||
self.assertEqual(payload['outcome'], 'pending')
|
||||
self.assertEqual(payload['target']['name'], 'nova')
|
||||
self.assertEqual(payload['target']['id'], 'openstack:resource_id')
|
||||
self.assertEqual(payload['target']['id'], 'resource_id')
|
||||
self.assertEqual(payload['target']['typeURI'],
|
||||
'service/compute/servers')
|
||||
|
||||
@ -482,7 +481,7 @@ class AuditApiLogicTest(BaseAuditMiddlewareTest):
|
||||
environ=env_headers)
|
||||
self.middleware._process_request(req)
|
||||
payload = req.environ['cadf_event'].as_dict()
|
||||
self.assertEqual(payload['target']['id'], identifier.norm_ns('nova'))
|
||||
self.assertEqual(payload['target']['id'], 'nova')
|
||||
|
||||
def test_endpoint_missing_internal_url(self):
|
||||
env_headers = {'HTTP_X_SERVICE_CATALOG':
|
||||
|
Loading…
Reference in New Issue
Block a user