[cloud] Fix ec2_group when security group lacks a VPC (#31526) (#31540)

This commit is contained in:
Sloane Hertel 2017-10-10 13:57:16 -04:00 committed by GitHub
parent 0e01684873
commit 3a0aa4ddff
2 changed files with 2 additions and 1 deletions

View file

@ -118,6 +118,7 @@ Ansible Changes By Release
* Better error message when attempting to use include or import with /usr/bin/ansible (https://github.com/ansible/ansible/pull/31492/)
* Fix `sysctl` module to remove etries when `state=absent` (https://github.com/ansible/ansible/issues/29920)
* Fix for ec2_group to avoid trying to iterate over None (https://github.com/ansible/ansible/pull/31531)
* Fix for ec2_group for a possible KeyError bug (https://github.com/ansible/ansible/pull/31540)
<a id="2.4"></a>

View file

@ -657,7 +657,7 @@ def main():
if group_id and sg['GroupId'] == group_id:
group = sg
elif groupName == name and (vpc_id is None or sg['VpcId'] == vpc_id):
elif groupName == name and (vpc_id is None or sg.get('VpcId') == vpc_id):
group = sg
# Ensure requested group is absent