diff options
author | Jason DeTiberus <detiber@gmail.com> | 2016-07-21 09:52:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-21 09:52:11 -0400 |
commit | a355349a98cecec1d10e7d166aa70d8e77df20e1 (patch) | |
tree | dbca76441caf841b0b0e7578497c84bb125a6b2a /lookup_plugins | |
parent | 893ffb6ec88b82d4607d9777ab741db1845d4f1e (diff) | |
parent | 887ba6a2a7263985d5f644e37e5428f0a8bd5166 (diff) | |
download | openshift-a355349a98cecec1d10e7d166aa70d8e77df20e1.tar.gz openshift-a355349a98cecec1d10e7d166aa70d8e77df20e1.tar.bz2 openshift-a355349a98cecec1d10e7d166aa70d8e77df20e1.tar.xz openshift-a355349a98cecec1d10e7d166aa70d8e77df20e1.zip |
Merge pull request #2187 from lhuard1A/bin_cluster_libvirt_ansible_2.1
Fix libvirt provider for Ansible 2.1.0.0
Diffstat (limited to 'lookup_plugins')
-rw-r--r-- | lookup_plugins/oo_option.py | 27 |
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: |