From c4629b72e065929dfabf2a1a8df07c622b4dd38f Mon Sep 17 00:00:00 2001 From: Scott Cunningham Date: Wed, 5 Aug 2015 23:37:10 -0700 Subject: [PATCH] credstash lookup plugin: error out in run function when credstash not installed, not at module scope --- lib/ansible/plugins/lookup/credstash.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ansible/plugins/lookup/credstash.py b/lib/ansible/plugins/lookup/credstash.py index febccfa5c65..5b4a0c0c406 100644 --- a/lib/ansible/plugins/lookup/credstash.py +++ b/lib/ansible/plugins/lookup/credstash.py @@ -29,13 +29,12 @@ except ImportError: CREDSTASH_INSTALLED = False -if not CREDSTASH_INSTALLED: - raise AnsibleError('The credstash lookup plugin requires credstash to be installed.') - - class LookupModule(LookupBase): def run(self, terms, variables, **kwargs): + if not CREDSTASH_INSTALLED: + raise AnsibleError('The credstash lookup plugin requires credstash to be installed.') + if isinstance(terms, basestring): terms = [terms]