Fix errors in lookup plugins.

Lookup plugins 'sequence' and 'template' now import 'ansible.utils'
appropriately in order to use the 'listify_lookup_plugin_terms'
function.

Also, 'dnstxt' and 'env' now check to see if 'terms' is a string;
without this calls like '{{ lookup('env', 'HOME') }}' fail.
pull/2700/head
C. Morgan Hamill 12 years ago
parent cce2cad8dc
commit 663d37b537

@ -44,8 +44,8 @@ class LookupModule(object):
terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject)
if isinstance(basestring, terms):
terms = [ terms ]
ret = []
for term in terms:

@ -27,6 +27,9 @@ class LookupModule(object):
terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject)
if isinstance(basestring, terms):
terms = [ terms ]
ret = []
for term in terms:
var = term.split()[0]

@ -26,7 +26,7 @@ class LookupModule(object):
def run(self, terms, inject=None, **kwargs):
utils.listify_lookup_plugin_terms(terms, self.basedir, inject)
terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject)
ret = []

@ -16,7 +16,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from ansible.errors import AnsibleError
from ansible.utils import parse_kv
import ansible.utils as utils
from re import compile as re_compile, IGNORECASE
# shortcut format
@ -181,7 +181,7 @@ class LookupModule(object):
try:
if not self.parse_simple_args(term):
self.parse_kv_args(parse_kv(term))
self.parse_kv_args(utils.parse_kv(term))
except Exception:
raise AnsibleError(
"unknown error parsing with_sequence arguments: %r"

@ -16,6 +16,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from ansible.utils import template
import ansible.utils as utils
class LookupModule(object):

Loading…
Cancel
Save