mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
[PR #8133/b389f863 backport][stable-8] Add descriptive error message to Linode inventory plugin file checkin… (#8144)
Add descriptive error message to Linode inventory plugin file checkin… (#8133)
* Add descriptive error message to Linode inventory plugin file checking, tests
* add changelog fragment
* Adjust changelog fragment.
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit b389f8637f
)
Co-authored-by: Gideon <soccerman.gid@gmail.com>
This commit is contained in:
parent
94890668a2
commit
8e9e989f8a
3 changed files with 37 additions and 7 deletions
|
@ -271,12 +271,25 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||
strict=strict)
|
||||
|
||||
def verify_file(self, path):
|
||||
"""Verify the Linode configuration file."""
|
||||
"""Verify the Linode configuration file.
|
||||
|
||||
Return true/false if the config-file is valid for this plugin
|
||||
|
||||
Args:
|
||||
str(path): path to the config
|
||||
Kwargs:
|
||||
None
|
||||
Raises:
|
||||
None
|
||||
Returns:
|
||||
bool(valid): is valid config file"""
|
||||
valid = False
|
||||
if super(InventoryModule, self).verify_file(path):
|
||||
endings = ('linode.yaml', 'linode.yml')
|
||||
if any((path.endswith(ending) for ending in endings)):
|
||||
return True
|
||||
return False
|
||||
if path.endswith(("linode.yaml", "linode.yml")):
|
||||
valid = True
|
||||
else:
|
||||
self.display.vvv('Inventory source not ending in "linode.yaml" or "linode.yml"')
|
||||
return valid
|
||||
|
||||
def parse(self, inventory, loader, path, cache=True):
|
||||
"""Dynamically parse Linode the cloud inventory."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue