def _stackid_format(self, resp):
"""
- Add a host:port:stack prefix, this formats the StackId in the response
- more like the AWS spec
+ Format the StackId field in the response as an ARN, and process other
+ IDs into the correct format.
"""
if 'StackId' in resp:
identity = identifier.HeatIdentifier(**resp['StackId'])
resp['StackId'] = identity.arn()
+ if 'EventId' in resp:
+ identity = identifier.EventIdentifier(**resp['EventId'])
+ resp['EventId'] = identity.event_id
return resp
@staticmethod
EVENT_RES_STATUS, EVENT_RES_STATUS_DATA, EVENT_RES_TYPE,
EVENT_RES_PROPERTIES,
) = (
- 'event_id',
+ 'event_identity',
STACK_ID, STACK_NAME,
"event_time",
RES_NAME, RES_PHYSICAL_ID,
stack_identifier = event.stack.identifier()
result = {
- EVENT_ID: event.id,
+ EVENT_ID: dict(event.identifier()),
EVENT_STACK_ID: dict(stack_identifier),
EVENT_STACK_NAME: stack_identifier.stack_name,
EVENT_TIMESTAMP: timeutils.isotime(event.timestamp),
u'path': u''},
u'logical_resource_id': u'WikiDatabase',
u'resource_status_reason': u'state changed',
- u'event_id': 42,
+ u'event_identity': {
+ u'tenant': u't',
+ u'stack_name': u'wordpress',
+ u'stack_id': u'6',
+ u'path': u'/resources/WikiDatabase/events/42'
+ },
u'resource_status': u'IN_PROGRESS',
u'physical_resource_id': None,
u'resource_properties':
expected = {'DescribeStackEventsResponse':
{'DescribeStackEventsResult':
{'StackEvents':
- [{'EventId': 42,
+ [{'EventId': u'42',
'StackId': u'arn:openstack:heat::t:stacks/wordpress/6',
'ResourceStatus': u'IN_PROGRESS',
'ResourceType': u'AWS::EC2::Instance',
self.assertEqual(len(events), 2)
for ev in events:
- self.assertTrue('event_id' in ev)
- self.assertTrue(ev['event_id'] > 0)
+ self.assertTrue('event_identity' in ev)
+ self.assertEqual(type(ev['event_identity']), dict)
+ self.assertTrue(ev['event_identity']['path'].rsplit('/', 1)[1])
self.assertTrue('logical_resource_id' in ev)
self.assertEqual(ev['logical_resource_id'], 'WebServer')