Starting to move over lookups and fixing some bugs related to that

This commit is contained in:
James Cammarata 2015-01-08 10:51:54 -06:00
parent 0823fb2cd9
commit 63c2d616e7
14 changed files with 236 additions and 61 deletions

View file

@ -15,30 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#from ansible.utils import safe_eval
#import ansible.utils as utils
#import ansible.errors as errors
from ansible.plugins.lookup import LookupBase
def flatten(terms):
ret = []
for term in terms:
if isinstance(term, list):
ret.extend(term)
else:
ret.append(term)
return ret
class LookupModule(object):
def __init__(self, basedir=None, **kwargs):
self.basedir = basedir
def run(self, terms, inject=None, **kwargs):
# FIXME: this function needs to be ported still, or something like it
# where really the intention is just to template a bare variable
# with the result being a list of terms
#terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject)
return flatten(terms)
class LookupModule(LookupBase):
def run(self, terms, **kwargs):
return self._flatten(terms)