aws_ec2 inv plugin: remove extra call to verify_file (#36588)

* Remove extra call to verify_file

* Allow next inventory plugin to be tried if the file isn't verified
pull/36532/merge
Sloane Hertel 7 years ago committed by GitHub
parent 5b5cba5e50
commit 73fd593d45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -444,7 +444,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
raise AnsibleError("Insufficient boto credentials found. Please provide them in your "
"inventory configuration file or set them as environment variables.")
def _validate_config(self, loader, path):
def verify_file(self, path):
'''
:param loader: an ansible.parsing.dataloader.DataLoader object
:param path: the path to the inventory config file
@ -452,8 +452,8 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
'''
if super(InventoryModule, self).verify_file(path):
if path.endswith('.aws_ec2.yml') or path.endswith('.aws_ec2.yaml'):
return self._read_config_data(path)
raise AnsibleParserError("Not a ec2 inventory plugin configuration file")
return True
return False
def _get_query_options(self, config_data):
'''
@ -501,7 +501,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
def parse(self, inventory, loader, path, cache=True):
super(InventoryModule, self).parse(inventory, loader, path)
config_data = self._validate_config(loader, path)
config_data = self._read_config_data(path)
self._set_credentials()
# get user specifications

Loading…
Cancel
Save