mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Support any Mapping for with_dict lookup.
This resolves 3939348286
breaking `with_dict: hostvars`.
This commit is contained in:
parent
c419cacb04
commit
77b60a1a67
1 changed files with 4 additions and 1 deletions
|
@ -17,6 +17,8 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
import collections
|
||||||
|
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from ansible.plugins.lookup import LookupBase
|
from ansible.plugins.lookup import LookupBase
|
||||||
|
|
||||||
|
@ -24,7 +26,8 @@ class LookupModule(LookupBase):
|
||||||
|
|
||||||
def run(self, terms, varibles=None, **kwargs):
|
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")
|
raise AnsibleError("with_dict expects a dict")
|
||||||
|
|
||||||
return self._flatten_hash_to_list(terms)
|
return self._flatten_hash_to_list(terms)
|
||||||
|
|
Loading…
Reference in a new issue