From 570f9db6bf313155822447772104e8ad0cb1b0ef Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Tue, 14 Apr 2015 17:42:57 -0400 Subject: [PATCH] Add/correct missing imports for AnsibleError in v2 lookup plugins --- v2/ansible/plugins/lookup/cartesian.py | 4 ++-- v2/ansible/plugins/lookup/dict.py | 3 ++- v2/ansible/plugins/lookup/indexed_items.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/v2/ansible/plugins/lookup/cartesian.py b/v2/ansible/plugins/lookup/cartesian.py index c50d53e7f8..7d8e08cb94 100644 --- a/v2/ansible/plugins/lookup/cartesian.py +++ b/v2/ansible/plugins/lookup/cartesian.py @@ -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)] diff --git a/v2/ansible/plugins/lookup/dict.py b/v2/ansible/plugins/lookup/dict.py index cc7975ae49..1b54f3db93 100644 --- a/v2/ansible/plugins/lookup/dict.py +++ b/v2/ansible/plugins/lookup/dict.py @@ -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) diff --git a/v2/ansible/plugins/lookup/indexed_items.py b/v2/ansible/plugins/lookup/indexed_items.py index 4f1dd19947..9e242ac6bf 100644 --- a/v2/ansible/plugins/lookup/indexed_items.py +++ b/v2/ansible/plugins/lookup/indexed_items.py @@ -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)