summaryrefslogtreecommitdiffstats
path: root/lookup_plugins/oo_option.py
diff options
context:
space:
mode:
authorAndrew Butcher <abutcher@redhat.com>2016-04-26 16:27:22 -0400
committerAndrew Butcher <abutcher@redhat.com>2016-04-26 16:41:41 -0400
commit6614d8a84bee661f75948cce3c4b458b146154e0 (patch)
tree026583c66ced744dd36863cb63489dd3ca04562f /lookup_plugins/oo_option.py
parente221ac190ca1f953d1a52834c22c12a7c9dc4a46 (diff)
downloadopenshift-6614d8a84bee661f75948cce3c4b458b146154e0.tar.gz
openshift-6614d8a84bee661f75948cce3c4b458b146154e0.tar.bz2
openshift-6614d8a84bee661f75948cce3c4b458b146154e0.tar.xz
openshift-6614d8a84bee661f75948cce3c4b458b146154e0.zip
Port lookup plugins to ansible v2.
Diffstat (limited to 'lookup_plugins/oo_option.py')
-rw-r--r--lookup_plugins/oo_option.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/lookup_plugins/oo_option.py b/lookup_plugins/oo_option.py
index 35dce48f9..3fc46ab9b 100644
--- a/lookup_plugins/oo_option.py
+++ b/lookup_plugins/oo_option.py
@@ -17,14 +17,36 @@ This returns, by order of priority:
* if none of the above conditions are met, empty string is returned
'''
-from ansible.utils import template
+
import os
+# pylint: disable=no-name-in-module,import-error,unused-argument,unused-variable,super-init-not-called,too-few-public-methods,missing-docstring
+try:
+ # ansible-2.0
+ from ansible.plugins.lookup import LookupBase
+except ImportError:
+ # ansible-1.9.x
+ class LookupBase(object):
+ def __init__(self, basedir=None, runner=None, **kwargs):
+ self.runner = runner
+ self.basedir = self.runner.basedir
+ 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
# pylint: disable=too-few-public-methods
-class LookupModule(object):
+class LookupModule(LookupBase):
''' oo_option lookup plugin main class '''
# Reason: disable unused-argument because Ansible is calling us with many