parent
61d5fe148c
commit
101f9f5f46
1 changed files with 3 additions and 3 deletions
|
@ -187,11 +187,11 @@ def find_subnets(vpc_conn, vpc_id, identified_subnets):
|
||||||
filters={'vpc_id': vpc_id, 'tag:Name': subnet_names})
|
filters={'vpc_id': vpc_id, 'tag:Name': subnet_names})
|
||||||
|
|
||||||
for name in subnet_names:
|
for name in subnet_names:
|
||||||
matching = [s.tags.get('Name') == name for s in subnets_by_name]
|
matching_count = len([1 for s in subnets_by_name if s.tags.get('Name') == name])
|
||||||
if len(matching) == 0:
|
if matching_count == 0:
|
||||||
raise AnsibleSubnetSearchException(
|
raise AnsibleSubnetSearchException(
|
||||||
'Subnet named "{0}" does not exist'.format(name))
|
'Subnet named "{0}" does not exist'.format(name))
|
||||||
elif len(matching) > 1:
|
elif matching_count > 1:
|
||||||
raise AnsibleSubnetSearchException(
|
raise AnsibleSubnetSearchException(
|
||||||
'Multiple subnets named "{0}"'.format(name))
|
'Multiple subnets named "{0}"'.format(name))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue