diff options
author | Sloane Hertel <shertel@redhat.com> | 2017-03-30 14:55:31 -0400 |
---|---|---|
committer | Ryan Brown <sb@ryansb.com> | 2017-03-30 14:55:31 -0400 |
commit | f5f7a8c681c486c94c697173c7b4f50e6db6664b (patch) | |
tree | 4e1252867aa069bf78dca81da86cb41be74e61fb /lib/ansible/modules/cloud/amazon | |
parent | dab0e75ce0a1cf02443818dbf0a0ae6478302dbb (diff) | |
download | ansible-f5f7a8c681c486c94c697173c7b4f50e6db6664b.tar.gz |
[cloud] only create new eni if none of the filters lead to one match (#22919)
Diffstat (limited to 'lib/ansible/modules/cloud/amazon')
-rw-r--r-- | lib/ansible/modules/cloud/amazon/ec2_eni.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/ansible/modules/cloud/amazon/ec2_eni.py b/lib/ansible/modules/cloud/amazon/ec2_eni.py index dbc136f8ba..37dde52d25 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_eni.py +++ b/lib/ansible/modules/cloud/amazon/ec2_eni.py @@ -483,9 +483,6 @@ def find_eni(connection, module): instance_id = module.params.get('instance_id') device_index = module.params.get('device_index') - if not eni_id: - return None - try: filters = {} if subnet_id: @@ -499,7 +496,7 @@ def find_eni(connection, module): filters['attachment.device-index'] = device_index eni_result = connection.get_all_network_interfaces(eni_id, filters=filters) - if len(eni_result) > 0: + if len(eni_result) == 1: return eni_result[0] else: return None |