Merge pull request #317 from spulec/ec2-security-group-tag-filtering

Add support to tag filtering to Security Groups
This commit is contained in:
Steve Pulec 2015-02-24 18:00:51 -05:00
commit c0e80de4d3
2 changed files with 16 additions and 1 deletions

View file

@ -92,7 +92,9 @@ from .utils import (
filter_reservations,
random_network_acl_id,
random_network_acl_subnet_association_id,
random_vpn_gateway_id)
random_vpn_gateway_id,
is_tag_filter,
)
def validate_resource_ids(resource_ids):
@ -1113,6 +1115,9 @@ class SecurityGroup(TaggedEC2Resource):
for ingress in self.ingress_rules:
if getattr(ingress, ingress_attr) in filter_value:
return True
elif is_tag_filter(key):
tag_value = self.get_filter_value(key)
return tag_value in filter_value
else:
attr_name = to_attr(key)
return getattr(self, attr_name) in filter_value