Add event IDs to CF Stack events (#852)
So that events can be uniquely identified. I tried to match the format documented here: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-listing-event-history.html
This commit is contained in:
parent
e7ea6b350c
commit
e7735c3ee1
@ -1,6 +1,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
import json
|
||||||
|
import uuid
|
||||||
|
|
||||||
import boto.cloudformation
|
import boto.cloudformation
|
||||||
from moto.core import BaseBackend
|
from moto.core import BaseBackend
|
||||||
@ -105,6 +106,7 @@ class FakeEvent(object):
|
|||||||
self.resource_status_reason = resource_status_reason
|
self.resource_status_reason = resource_status_reason
|
||||||
self.resource_properties = resource_properties
|
self.resource_properties = resource_properties
|
||||||
self.timestamp = datetime.utcnow()
|
self.timestamp = datetime.utcnow()
|
||||||
|
self.event_id = uuid.uuid4()
|
||||||
|
|
||||||
|
|
||||||
class CloudFormationBackend(BaseBackend):
|
class CloudFormationBackend(BaseBackend):
|
||||||
|
@ -522,6 +522,7 @@ def test_describe_stack_events_shows_create_update_and_delete():
|
|||||||
for event in events:
|
for event in events:
|
||||||
event.stack_id.should.equal(stack_id)
|
event.stack_id.should.equal(stack_id)
|
||||||
event.stack_name.should.equal("test_stack")
|
event.stack_name.should.equal("test_stack")
|
||||||
|
event.event_id.should.match(r"[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}")
|
||||||
|
|
||||||
if event.resource_type == "AWS::CloudFormation::Stack":
|
if event.resource_type == "AWS::CloudFormation::Stack":
|
||||||
event.logical_resource_id.should.equal("test_stack")
|
event.logical_resource_id.should.equal("test_stack")
|
||||||
|
@ -358,6 +358,7 @@ def test_stack_events():
|
|||||||
for event in events:
|
for event in events:
|
||||||
event.stack_id.should.equal(stack.stack_id)
|
event.stack_id.should.equal(stack.stack_id)
|
||||||
event.stack_name.should.equal("test_stack")
|
event.stack_name.should.equal("test_stack")
|
||||||
|
event.event_id.should.match(r"[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}")
|
||||||
|
|
||||||
if event.resource_type == "AWS::CloudFormation::Stack":
|
if event.resource_type == "AWS::CloudFormation::Stack":
|
||||||
event.logical_resource_id.should.equal("test_stack")
|
event.logical_resource_id.should.equal("test_stack")
|
||||||
|
Loading…
Reference in New Issue
Block a user