Fix the linode inventory plugin, and the redis and memcached cache plugins (#1281, #1282, #1283).

This commit is contained in:
Felix Fontein 2020-11-13 21:34:56 +01:00 committed by David Moreau Simard
commit 75fd32ca55
4 changed files with 19 additions and 3 deletions

View file

@ -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()