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:
Sloane Hertel 2018-10-11 12:06:52 -04:00 committed by Alicia Cozine
parent e3882ad6f6
commit f3d5ebb355
9 changed files with 21 additions and 22 deletions

View file

@ -16,7 +16,7 @@ DOCUMENTATION = r'''
- linode_api4 >= 2.0.0
description:
- Reads inventories from the Linode API v4.
- Uses a C(<name>.linode.yaml) (or C(<name>.linode.yml)) YAML configuration file.
- Uses a YAML configuration file that ends with linode.(yml|yaml).
- Linode labels are used by default as the hostnames.
- The inventory groups are built from groups and not tags.
options:
@ -186,7 +186,7 @@ class InventoryModule(BaseInventoryPlugin):
def verify_file(self, path):
"""Verify the Linode configuration file."""
if super(InventoryModule, self).verify_file(path):
endings = ('.linode.yaml', '.linode.yml')
endings = ('linode.yaml', 'linode.yml')
if any((path.endswith(ending) for ending in endings)):
return True
return False