mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix ec2_group for EC2-Classic accounts (#46242)
* Fix ec2_group for EC2-Classic accounts * changelog
This commit is contained in:
parent
23c94295dc
commit
9efc3dc761
2 changed files with 8 additions and 1 deletions
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
bugfixes:
|
||||||
|
- The patch fixing the regression of no longer preferring matching security
|
||||||
|
groups in the same VPC https://github.com/ansible/ansible/pull/45787
|
||||||
|
(which was also backported to 2.6) broke EC2-Classic accounts.
|
||||||
|
https://github.com/ansible/ansible/pull/46242 removes the assumption that
|
||||||
|
security groups must be in a VPC.
|
|
@ -856,7 +856,7 @@ def group_exists(client, module, vpc_id, group_id, name):
|
||||||
groups = dict((group['GroupId'], group) for group in all_groups)
|
groups = dict((group['GroupId'], group) for group in all_groups)
|
||||||
groups.update(dict((group['GroupName'], group) for group in all_groups))
|
groups.update(dict((group['GroupName'], group) for group in all_groups))
|
||||||
if vpc_id:
|
if vpc_id:
|
||||||
vpc_wins = dict((group['GroupName'], group) for group in all_groups if group['VpcId'] == vpc_id)
|
vpc_wins = dict((group['GroupName'], group) for group in all_groups if group.get('VpcId') and group['VpcId'] == vpc_id)
|
||||||
groups.update(vpc_wins)
|
groups.update(vpc_wins)
|
||||||
# maintain backwards compatibility by using the last matching group
|
# maintain backwards compatibility by using the last matching group
|
||||||
return security_groups[-1], groups
|
return security_groups[-1], groups
|
||||||
|
|
Loading…
Reference in a new issue