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

@ -10,7 +10,7 @@ DOCUMENTATION = '''
short_description: virtualbox inventory source
description:
- Get inventory hosts from the local virtualbox installation.
- Uses a <name>.vbox.yaml (or .vbox.yml) YAML configuration file.
- Uses a YAML configuration file that ends with virtualbox.(yml|yaml) or vbox.(yml|yaml).
- The inventory_hostname is always the 'Name' of the virtualbox instance.
extends_documentation_fragment:
- constructed
@ -210,7 +210,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
valid = False
if super(InventoryModule, self).verify_file(path):
if path.endswith(('.vbox.yaml', '.vbox.yml')):
if path.endswith(('virtualbox.yaml', 'virtualbox.yml', 'vbox.yaml', 'vbox.yml')):
valid = True
return valid