Add/correct missing imports for AnsibleError in v2 lookup plugins

pull/10715/head
Michael Scherer 10 years ago
parent f25f2d9626
commit 570f9db6bf

@ -19,7 +19,7 @@ __metaclass__ = type
from itertools import product
from ansible.errors import *
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
from ansible.utils.listify import listify_lookup_plugin_terms
@ -42,7 +42,7 @@ class LookupModule(LookupBase):
my_list = terms[:]
if len(my_list) == 0:
raise errors.AnsibleError("with_cartesian requires at least one element in each list")
raise AnsibleError("with_cartesian requires at least one element in each list")
return [self._flatten(x) for x in product(*my_list, fillvalue=None)]

@ -17,6 +17,7 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
class LookupModule(LookupBase):
@ -24,6 +25,6 @@ class LookupModule(LookupBase):
def run(self, terms, varibles=None, **kwargs):
if not isinstance(terms, dict):
raise errors.AnsibleError("with_dict expects a dict")
raise AnsibleError("with_dict expects a dict")
return self._flatten_hash_to_list(terms)

@ -17,6 +17,7 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
class LookupModule(LookupBase):
@ -27,7 +28,7 @@ class LookupModule(LookupBase):
def run(self, terms, variables, **kwargs):
if not isinstance(terms, list):
raise errors.AnsibleError("with_indexed_items expects a list")
raise AnsibleError("with_indexed_items expects a list")
items = self._flatten(terms)
return zip(range(len(items)), items)

Loading…
Cancel
Save