mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-30 14:21:26 -07: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:
parent
e3882ad6f6
commit
f3d5ebb355
9 changed files with 21 additions and 22 deletions
|
@ -12,7 +12,7 @@ DOCUMENTATION = r'''
|
|||
- azure
|
||||
description:
|
||||
- Query VM details from Azure Resource Manager
|
||||
- Requires a YAML configuration file whose name ends with '.azure_rm.yaml'
|
||||
- Requires a YAML configuration file whose name ends with 'azure_rm.(yml|yaml)'
|
||||
- By default, sets C(ansible_host) to the first public IP address found (preferring the primary NIC). If no
|
||||
public IPs are found, the first private IP (also preferring the primary NIC). The default may be overridden
|
||||
via C(hostvar_expressions); see examples.
|
||||
|
@ -216,9 +216,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||
:return the contents of the config file
|
||||
'''
|
||||
if super(InventoryModule, self).verify_file(path):
|
||||
if re.match(r'.+\.azure_rm\.y(a)?ml$', path):
|
||||
if re.match(r'.{0,}azure_rm\.y(a)?ml$', path):
|
||||
return True
|
||||
# display.debug("azure_rm inventory filename must match '*.azure_rm.yml' or '*.azure_rm.yaml'")
|
||||
# display.debug("azure_rm inventory filename must end with 'azure_rm.yml' or 'azure_rm.yaml'")
|
||||
return False
|
||||
|
||||
def parse(self, inventory, loader, path, cache=True):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue