summaryrefslogtreecommitdiffstats
path: root/lookup_plugins
diff options
context:
space:
mode:
authorLénaïc Huard <lhuard@amadeus.com>2016-07-20 18:07:10 +0200
committerLénaïc Huard <lhuard@amadeus.com>2016-07-21 09:11:36 +0200
commit887ba6a2a7263985d5f644e37e5428f0a8bd5166 (patch)
treef35fd9dc344f3da1a131dc4de9456e40b0056f03 /lookup_plugins
parente56778743abfc0d349ec8bead684389a7c253cc2 (diff)
downloadopenshift-887ba6a2a7263985d5f644e37e5428f0a8bd5166.tar.gz
openshift-887ba6a2a7263985d5f644e37e5428f0a8bd5166.tar.bz2
openshift-887ba6a2a7263985d5f644e37e5428f0a8bd5166.tar.xz
openshift-887ba6a2a7263985d5f644e37e5428f0a8bd5166.zip
Fix libvirt provider for Ansible 2.1.0.0
Diffstat (limited to 'lookup_plugins')
-rw-r--r--lookup_plugins/oo_option.py27
1 files changed, 3 insertions, 24 deletions
diff --git a/lookup_plugins/oo_option.py b/lookup_plugins/oo_option.py
index 3fc46ab9b..bca545771 100644
--- a/lookup_plugins/oo_option.py
+++ b/lookup_plugins/oo_option.py
@@ -33,15 +33,6 @@ except ImportError:
def get_basedir(self, variables):
return self.basedir
-# pylint: disable=no-name-in-module,import-error
-try:
- # ansible-2.0
- from ansible import template
-except ImportError:
- # ansible 1.9.x
- from ansible.utils import template
-
-
# Reason: disable too-few-public-methods because the `run` method is the only
# one required by the Ansible API
# Status: permanently disabled
@@ -65,28 +56,16 @@ class LookupModule(LookupBase):
# which is not used
# Status: permanently disabled unless Ansible API evolves
# pylint: disable=unused-argument
- def run(self, terms, inject=None, **kwargs):
+ def run(self, terms, variables, **kwargs):
''' Main execution path '''
- try:
- terms = template.template(self.basedir, terms, inject)
- # Reason: disable broad-except to really ignore any potential exception
- # This is inspired by the upstream "env" lookup plugin:
- # https://github.com/ansible/ansible/blob/devel/v1/ansible/runner/lookup_plugins/env.py#L29
- # pylint: disable=broad-except
- except Exception:
- pass
-
- if isinstance(terms, basestring):
- terms = [terms]
-
ret = []
for term in terms:
option_name = term.split()[0]
cli_key = 'cli_' + option_name
- if inject and cli_key in inject:
- ret.append(inject[cli_key])
+ if 'vars' in variables and cli_key in variables['vars']:
+ ret.append(variables['vars'][cli_key])
elif option_name in os.environ:
ret.append(os.environ[option_name])
else: