mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
credstash lookup plugin: raise AnsibleError when credstash library not installed
This commit is contained in:
parent
695e456cb0
commit
193e857bc4
1 changed files with 11 additions and 1 deletions
|
@ -20,7 +20,17 @@ __metaclass__ = type
|
|||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
|
||||
import credstash
|
||||
CREDSTASH_INSTALLED = False
|
||||
|
||||
try:
|
||||
import credstash
|
||||
CREDSTASH_INSTALLED = True
|
||||
except ImportError:
|
||||
CREDSTASH_INSTALLED = False
|
||||
|
||||
|
||||
if not CREDSTASH_INSTALLED:
|
||||
raise AnsibleError('The credstash lookup plugin requires credstash to be installed.')
|
||||
|
||||
|
||||
class LookupModule(LookupBase):
|
||||
|
|
Loading…
Reference in a new issue