From 8d1549900c65d622dbb129e9f957de7aa4ff84a5 Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Fri, 17 Jul 2015 17:36:37 +0200 Subject: [PATCH] fix AnsibleError object name in subelements plugin fixes #11624 --- lib/ansible/plugins/lookup/subelements.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/plugins/lookup/subelements.py b/lib/ansible/plugins/lookup/subelements.py index b934a053ebf..d8c2b1086e3 100644 --- a/lib/ansible/plugins/lookup/subelements.py +++ b/lib/ansible/plugins/lookup/subelements.py @@ -30,7 +30,7 @@ class LookupModule(LookupBase): def run(self, terms, variables, **kwargs): def _raise_terms_error(msg=""): - raise errors.AnsibleError( + raise AnsibleError( "subelements lookup expects a list of two or three items, " + msg) terms = listify_lookup_plugin_terms(terms, variables, loader=self._loader) @@ -66,7 +66,7 @@ class LookupModule(LookupBase): ret = [] for item0 in elementlist: if not isinstance(item0, dict): - raise errors.AnsibleError("subelements lookup expects a dictionary, got '%s'" % item0) + raise AnsibleError("subelements lookup expects a dictionary, got '%s'" % item0) if item0.get('skipped', False) is not False: # this particular item is to be skipped continue @@ -82,18 +82,18 @@ class LookupModule(LookupBase): if skip_missing: continue else: - raise errors.AnsibleError("could not find '%s' key in iterated item '%s'" % (subkey, subvalue)) + raise AnsibleError("could not find '%s' key in iterated item '%s'" % (subkey, subvalue)) if not lastsubkey: if not isinstance(subvalue[subkey], dict): if skip_missing: continue else: - raise errors.AnsibleError("the key %s should point to a dictionary, got '%s'" % (subkey, subvalue[subkey])) + raise AnsibleError("the key %s should point to a dictionary, got '%s'" % (subkey, subvalue[subkey])) else: subvalue = subvalue[subkey] else: # lastsubkey if not isinstance(subvalue[subkey], list): - raise errors.AnsibleError("the key %s should point to a list, got '%s'" % (subkey, subvalue[subkey])) + raise AnsibleError("the key %s should point to a list, got '%s'" % (subkey, subvalue[subkey])) else: sublist = subvalue.pop(subkey, []) for item1 in sublist: