credstash lookup plugin: raise AnsibleError when credstash library not installed

This commit is contained in:
Scott Cunningham 2015-07-30 21:04:26 +01:00
parent 695e456cb0
commit 193e857bc4

View file

@ -20,7 +20,17 @@ __metaclass__ = type
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
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):