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.errors import AnsibleError
|
||||||
from ansible.plugins.lookup import LookupBase
|
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):
|
class LookupModule(LookupBase):
|
||||||
|
|
Loading…
Reference in a new issue