mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-23 20:44:00 -07:00
Only read EC2 regions_exclude list if necessary (#18720)
When specifying a literal whitelist of AWS EC2 regions in the dynamic inventory configuration file, it should not be necessary to also include a literal blacklist, especially as the blacklist is not honored in this case anyway. By reading the literal blacklist only when necessary, it is possible for a user to provide a more minimal EC2 configuration file. Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
This commit is contained in:
parent
98c98125f0
commit
6318229bc4
2 changed files with 4 additions and 3 deletions
|
|
@ -250,11 +250,11 @@ class Ec2Inventory(object):
|
|||
# Regions
|
||||
self.regions = []
|
||||
configRegions = config.get('ec2', 'regions')
|
||||
configRegions_exclude = config.get('ec2', 'regions_exclude')
|
||||
if (configRegions == 'all'):
|
||||
if self.eucalyptus_host:
|
||||
self.regions.append(boto.connect_euca(host=self.eucalyptus_host).region.name, **self.credentials)
|
||||
else:
|
||||
configRegions_exclude = config.get('ec2', 'regions_exclude')
|
||||
for regionInfo in ec2.regions():
|
||||
if regionInfo.name not in configRegions_exclude:
|
||||
self.regions.append(regionInfo.name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue