1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03: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:
Sloane Hertel 2018-10-11 12:06:52 -04:00 committed by AlanCoding
parent 79166209ee
commit 5dc9ca222f
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B

View File

@ -16,7 +16,7 @@ DOCUMENTATION = '''
description:
- Reads inventories from Ansible Tower.
- Supports reading configuration from both YAML config file and environment variables.
- If reading from the YAML file, the file name must end with tower_inventory.(yml|yaml),
- If reading from the YAML file, the file name must end with tower.(yml|yaml) or tower_inventory.(yml|yaml),
the path in the command would be /path/to/tower_inventory.(yml|yaml). If some arguments in the config file
are missing, this plugin will try to fill in missing arguments by reading from environment variables.
- If reading configurations from environment variables, the path in the command must be @tower_inventory.
@ -143,7 +143,7 @@ class InventoryModule(BaseInventoryPlugin):
self.no_config_file_supplied = True
return True
elif super(InventoryModule, self).verify_file(path):
return path.endswith('tower_inventory.yml') or path.endswith('tower_inventory.yaml')
return path.endswith(('tower_inventory.yml', 'tower_inventory.yaml', 'tower.yml', 'tower.yaml'))
else:
return False