Fix security group tags. Closes #301.
This commit is contained in:
parent
31bf84b363
commit
5ededbb297
3 changed files with 33 additions and 6 deletions
|
|
@ -163,7 +163,7 @@ class NetworkInterface(object):
|
|||
group = self.ec2_backend.get_security_group_from_id(group_id)
|
||||
if not group:
|
||||
# Create with specific group ID.
|
||||
group = SecurityGroup(group_id, group_id, group_id, vpc_id=subnet.vpc_id)
|
||||
group = SecurityGroup(group.ec2_backend, group_id, group_id, group_id, vpc_id=subnet.vpc_id)
|
||||
self.ec2_backend.groups[subnet.vpc_id][group_id] = group
|
||||
if group:
|
||||
self._group_set.append(group)
|
||||
|
|
@ -1016,8 +1016,9 @@ class SecurityRule(object):
|
|||
return self.unique_representation == other.unique_representation
|
||||
|
||||
|
||||
class SecurityGroup(object):
|
||||
def __init__(self, group_id, name, description, vpc_id=None):
|
||||
class SecurityGroup(TaggedEC2Resource):
|
||||
def __init__(self, ec2_backend, group_id, name, description, vpc_id=None):
|
||||
self.ec2_backend = ec2_backend
|
||||
self.id = group_id
|
||||
self.name = name
|
||||
self.description = description
|
||||
|
|
@ -1116,7 +1117,7 @@ class SecurityGroupBackend(object):
|
|||
existing_group = self.get_security_group_from_name(name, vpc_id)
|
||||
if existing_group:
|
||||
raise InvalidSecurityGroupDuplicateError(name)
|
||||
group = SecurityGroup(group_id, name, description, vpc_id=vpc_id)
|
||||
group = SecurityGroup(self, group_id, name, description, vpc_id=vpc_id)
|
||||
|
||||
self.groups[vpc_id][group_id] = group
|
||||
return group
|
||||
|
|
|
|||
|
|
@ -133,6 +133,16 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """<DescribeSecurityGroupsResponse xmlns="ht
|
|||
{% endfor %}
|
||||
</ipPermissions>
|
||||
<ipPermissionsEgress/>
|
||||
<tagSet>
|
||||
{% for tag in group.get_tags() %}
|
||||
<item>
|
||||
<resourceId>{{ tag.resource_id }}</resourceId>
|
||||
<resourceType>{{ tag.resource_type }}</resourceType>
|
||||
<key>{{ tag.key }}</key>
|
||||
<value>{{ tag.value }}</value>
|
||||
</item>
|
||||
{% endfor %}
|
||||
</tagSet>
|
||||
</item>
|
||||
{% endfor %}
|
||||
</securityGroupInfo>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue