From 73fd593d455c3c29c2e9c42a25c8db45f7054e6f Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Thu, 22 Feb 2018 12:10:47 -0500 Subject: [PATCH] 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 --- lib/ansible/plugins/inventory/aws_ec2.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/plugins/inventory/aws_ec2.py b/lib/ansible/plugins/inventory/aws_ec2.py index 6254abdc227..138db09abb9 100644 --- a/lib/ansible/plugins/inventory/aws_ec2.py +++ b/lib/ansible/plugins/inventory/aws_ec2.py @@ -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