removed cruft

made sure it does not fail on undefined
pull/4420/head
Brian Coca 2015-06-11 00:13:40 -04:00
parent f29c1c7452
commit 7291f9e965
1 changed files with 5 additions and 6 deletions

View File

@ -19,24 +19,23 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
from six import iteritems, string_types
import re
from ansible.template import Templar from ansible.template import Templar
from ansible.template.safe_eval import safe_eval from ansible.template.safe_eval import safe_eval
__all__ = ['listify_lookup_plugin_terms'] __all__ = ['listify_lookup_plugin_terms']
LOOKUP_REGEX = re.compile(r'lookup\s*\(') #FIXME: probably just move this into lookup plugin base class
def listify_lookup_plugin_terms(terms, variables, loader): def listify_lookup_plugin_terms(terms, variables, loader):
if isinstance(terms, basestring): if isinstance(terms, basestring):
stripped = terms.strip() stripped = terms.strip()
templar = Templar(loader=loader, variables=variables) templar = Templar(loader=loader, variables=variables)
terms = templar.template(terms, convert_bare=True)
#FIXME: warn/deprecation on bare vars in with_ so we can eventually remove fail on undefined override
terms = templar.template(terms, convert_bare=True, fail_on_undefined=False)
#TODO: check if this is needed as template should also return correct type already
terms = safe_eval(terms) terms = safe_eval(terms)
if isinstance(terms, basestring): if isinstance(terms, basestring):