EC2 tags specified in CloudFormation should be applied to the instances (#840)
Fixes #839.
This commit is contained in:
parent
1b6007e2b2
commit
a30ba2b597
@ -336,7 +336,7 @@ class NetworkInterfaceBackend(object):
|
|||||||
return generic_filter(filters, enis)
|
return generic_filter(filters, enis)
|
||||||
|
|
||||||
|
|
||||||
class Instance(BotoInstance, TaggedEC2Resource):
|
class Instance(TaggedEC2Resource, BotoInstance):
|
||||||
def __init__(self, ec2_backend, image_id, user_data, security_groups, **kwargs):
|
def __init__(self, ec2_backend, image_id, user_data, security_groups, **kwargs):
|
||||||
super(Instance, self).__init__()
|
super(Instance, self).__init__()
|
||||||
self.ec2_backend = ec2_backend
|
self.ec2_backend = ec2_backend
|
||||||
@ -441,7 +441,10 @@ class Instance(BotoInstance, TaggedEC2Resource):
|
|||||||
key_name=properties.get("KeyName"),
|
key_name=properties.get("KeyName"),
|
||||||
private_ip=properties.get('PrivateIpAddress'),
|
private_ip=properties.get('PrivateIpAddress'),
|
||||||
)
|
)
|
||||||
return reservation.instances[0]
|
instance = reservation.instances[0]
|
||||||
|
for tag in properties.get("Tags", []):
|
||||||
|
instance.add_tag(tag["Key"], tag["Value"])
|
||||||
|
return instance
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def physical_resource_id(self):
|
def physical_resource_id(self):
|
||||||
|
@ -236,6 +236,10 @@ template = {
|
|||||||
"Ref": "AWS::StackId"
|
"Ref": "AWS::StackId"
|
||||||
},
|
},
|
||||||
"Key": "Application"
|
"Key": "Application"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Value": "Bar",
|
||||||
|
"Key": "Foo"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"SecurityGroupIds": [
|
"SecurityGroupIds": [
|
||||||
|
@ -676,6 +676,7 @@ def test_vpc_single_instance_in_subnet():
|
|||||||
ec2_conn = boto.ec2.connect_to_region("us-west-1")
|
ec2_conn = boto.ec2.connect_to_region("us-west-1")
|
||||||
reservation = ec2_conn.get_all_instances()[0]
|
reservation = ec2_conn.get_all_instances()[0]
|
||||||
instance = reservation.instances[0]
|
instance = reservation.instances[0]
|
||||||
|
instance.tags["Foo"].should.equal("Bar")
|
||||||
# Check that the EIP is attached the the EC2 instance
|
# Check that the EIP is attached the the EC2 instance
|
||||||
eip = ec2_conn.get_all_addresses()[0]
|
eip = ec2_conn.get_all_addresses()[0]
|
||||||
eip.domain.should.equal('vpc')
|
eip.domain.should.equal('vpc')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user