mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Be more lenient in instance check: MutableMapping is more general than dict
This commit is contained in:
parent
3a87b2727d
commit
7f21f270d9
1 changed files with 3 additions and 2 deletions
|
@ -22,6 +22,7 @@ __metaclass__ = type
|
|||
import os
|
||||
|
||||
from collections import defaultdict
|
||||
from collections import MutableMapping
|
||||
|
||||
try:
|
||||
from hashlib import sha1
|
||||
|
@ -73,7 +74,7 @@ class VariableManager:
|
|||
|
||||
def set_extra_vars(self, value):
|
||||
''' ensures a clean copy of the extra_vars are used to set the value '''
|
||||
assert isinstance(value, dict)
|
||||
assert isinstance(value, MutableMapping)
|
||||
self._extra_vars = value.copy()
|
||||
|
||||
def set_inventory(self, inventory):
|
||||
|
@ -83,7 +84,7 @@ class VariableManager:
|
|||
'''
|
||||
Validates that both arguments are dictionaries, or an error is raised.
|
||||
'''
|
||||
if not (isinstance(a, dict) and isinstance(b, dict)):
|
||||
if not (isinstance(a, MutableMapping) and isinstance(b, MutableMapping)):
|
||||
raise AnsibleError("failed to combine variables, expected dicts but got a '%s' and a '%s'" % (type(a).__name__, type(b).__name__))
|
||||
|
||||
def _combine_vars(self, a, b):
|
||||
|
|
Loading…
Reference in a new issue