summaryrefslogtreecommitdiffstats
path: root/lookup_plugins/oo_option.py
diff options
context:
space:
mode:
authorJason DeTiberus <detiber@gmail.com>2016-04-26 18:56:31 -0400
committerJason DeTiberus <detiber@gmail.com>2016-04-26 18:56:31 -0400
commit207b5aea8d619acb9622a351f54301c24598b08d (patch)
tree026583c66ced744dd36863cb63489dd3ca04562f /lookup_plugins/oo_option.py
parente221ac190ca1f953d1a52834c22c12a7c9dc4a46 (diff)
parent6614d8a84bee661f75948cce3c4b458b146154e0 (diff)
downloadopenshift-207b5aea8d619acb9622a351f54301c24598b08d.tar.gz
openshift-207b5aea8d619acb9622a351f54301c24598b08d.tar.bz2
openshift-207b5aea8d619acb9622a351f54301c24598b08d.tar.xz
openshift-207b5aea8d619acb9622a351f54301c24598b08d.zip
Merge pull request #1813 from abutcher/v2-lookup
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