mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-19 19:30:22 -07:00
This commit is contained in:
parent
07fa7ea409
commit
75fd32ca55
4 changed files with 19 additions and 3 deletions
|
@ -63,8 +63,9 @@ from ansible.plugins.inventory import BaseInventoryPlugin
|
|||
try:
|
||||
from linode_api4 import LinodeClient
|
||||
from linode_api4.errors import ApiError as LinodeApiError
|
||||
HAS_LINODE = True
|
||||
except ImportError:
|
||||
raise AnsibleError('the Linode dynamic inventory plugin requires linode_api4.')
|
||||
HAS_LINODE = False
|
||||
|
||||
|
||||
class InventoryModule(BaseInventoryPlugin):
|
||||
|
@ -194,6 +195,9 @@ class InventoryModule(BaseInventoryPlugin):
|
|||
"""Dynamically parse Linode the cloud inventory."""
|
||||
super(InventoryModule, self).parse(inventory, loader, path)
|
||||
|
||||
if not HAS_LINODE:
|
||||
raise AnsibleError('the Linode dynamic inventory plugin requires linode_api4.')
|
||||
|
||||
config_data = self._read_config_data(path)
|
||||
self._build_client()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue