diff options
author | Sloane Hertel <19572925+s-hertel@users.noreply.github.com> | 2021-01-11 18:26:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-11 17:26:21 -0600 |
commit | 6065dfb29104a4fd5cd2ade216babda6ab6b2a2f (patch) | |
tree | 0319ba963cf89628139c19a8e68e33be545db615 /lib | |
parent | d65fa6878f8dea86e52a4f70f9d1e3dd058da1ce (diff) | |
download | ansible-6065dfb29104a4fd5cd2ade216babda6ab6b2a2f.tar.gz |
[2.9] Pass the top level dictionaries to combine_vars (#72979) (#73147)
combine_vars uses dict.update() to replace keys
(cherry picked from commit 5e03e322de5b43b69c8aad5c0cb92e82ce0f3d17)
* Add tests for merging and replacing vars from inventory sources (#73181)
(cherry picked from commit 9de2da8a7ee1c0219b804b6afc7b090101106743)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ansible/inventory/group.py | 2 | ||||
-rw-r--r-- | lib/ansible/inventory/host.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/ansible/inventory/group.py b/lib/ansible/inventory/group.py index 0dd91bb76d..e7878d3595 100644 --- a/lib/ansible/inventory/group.py +++ b/lib/ansible/inventory/group.py @@ -248,7 +248,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 diff --git a/lib/ansible/inventory/host.py b/lib/ansible/inventory/host.py index 7ad300790d..a3e41f53b6 100644 --- a/lib/ansible/inventory/host.py +++ b/lib/ansible/inventory/host.py @@ -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 |