Pass the top level dictionaries to combine_vars (#72979)

* Pass the top level dictionaries to combine_vars

combine_vars uses dict.update() to replace keys
This commit is contained in:
Sloane Hertel 2020-12-16 11:23:23 -05:00 committed by GitHub
parent 6487a239c0
commit 5e03e322de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- inventory - pass the vars dictionary to combine_vars instead of an individual key's value (https://github.com/ansible/ansible/issues/72975).

View file

@ -247,7 +247,7 @@ class Group:
self.set_priority(int(value))
else:
if key in self.vars and isinstance(self.vars[key], MutableMapping) and isinstance(value, Mapping):
self.vars[key] = combine_vars(self.vars[key], value)
self.vars = combine_vars(self.vars, {key: value})
else:
self.vars[key] = value

View file

@ -143,7 +143,7 @@ class Host:
def set_variable(self, key, value):
if key in self.vars and isinstance(self.vars[key], MutableMapping) and isinstance(value, Mapping):
self.vars[key] = combine_vars(self.vars[key], value)
self.vars = combine_vars(self.vars, {key: value})
else:
self.vars[key] = value