From 77b60a1a67d1c0defe146f718ac7ccbf303a8205 Mon Sep 17 00:00:00 2001 From: Alphadelta14 Date: Mon, 17 Aug 2015 20:11:24 -0400 Subject: [PATCH] Support any Mapping for with_dict lookup. This resolves 39393482865201532da778f103aef35d35c38026 breaking `with_dict: hostvars`. --- lib/ansible/plugins/lookup/dict.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/lookup/dict.py b/lib/ansible/plugins/lookup/dict.py index 1b54f3db93..e9c2596b23 100644 --- a/lib/ansible/plugins/lookup/dict.py +++ b/lib/ansible/plugins/lookup/dict.py @@ -17,6 +17,8 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type +import collections + from ansible.errors import AnsibleError from ansible.plugins.lookup import LookupBase @@ -24,7 +26,8 @@ class LookupModule(LookupBase): def run(self, terms, varibles=None, **kwargs): - if not isinstance(terms, dict): + # Expect any type of Mapping, notably hostvars + if not isinstance(terms, collections.Mapping): raise AnsibleError("with_dict expects a dict") return self._flatten_hash_to_list(terms)