mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
add more consistent extension matching for inventory plugins (#46786)
* Add consistent extension matching for inventory plugins that support YAML configuration files * Document extension matching expectations
This commit is contained in:
committed by
Alicia Cozine
parent
e3882ad6f6
commit
f3d5ebb355
@@ -16,7 +16,7 @@ DOCUMENTATION = '''
|
||||
- constructed
|
||||
description:
|
||||
- Get inventory hosts from Amazon Web Services EC2.
|
||||
- Uses a <name>.aws_ec2.yaml (or <name>.aws_ec2.yml) YAML configuration file.
|
||||
- Uses a YAML configuration file that ends with aws_ec2.(yml|yaml).
|
||||
options:
|
||||
plugin:
|
||||
description: token that ensures this is a source file for the 'aws_ec2' plugin.
|
||||
@@ -509,9 +509,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||
:return the contents of the config file
|
||||
'''
|
||||
if super(InventoryModule, self).verify_file(path):
|
||||
if path.endswith('.aws_ec2.yml') or path.endswith('.aws_ec2.yaml'):
|
||||
if path.endswith(('aws_ec2.yml', 'aws_ec2.yaml')):
|
||||
return True
|
||||
display.debug("aws_ec2 inventory filename must end with '*.aws_ec2.yml' or '*.aws_ec2.yaml'")
|
||||
display.debug("aws_ec2 inventory filename must end with 'aws_ec2.yml' or 'aws_ec2.yaml'")
|
||||
return False
|
||||
|
||||
def _get_query_options(self, config_data):
|
||||
|
||||
Reference in New Issue
Block a user