mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #10715 from mscherer/fix_import_errors_lookup_plugin
Add/correct missing imports for AnsibleError in v2 lookup plugins
This commit is contained in:
commit
67e59c5429
3 changed files with 6 additions and 4 deletions
|
@ -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…
Reference in a new issue