diff --git a/changelog/63933.fixed.md b/changelog/63933.fixed.md new file mode 100644 index 00000000000..794c170bd04 --- /dev/null +++ b/changelog/63933.fixed.md @@ -0,0 +1,4 @@ +Issue 63933: Fixes an issue with `saltclass.expanded_dict_from_minion` +function where it was passing a reference to minion `dict` which was +overridden by nested classes during class expansion. Copy the node +definition with `copy.deepcopy` instead of passing a reference. diff --git a/salt/utils/saltclass.py b/salt/utils/saltclass.py index 1f6df19d128..c18d01af3d1 100644 --- a/salt/utils/saltclass.py +++ b/salt/utils/saltclass.py @@ -1,3 +1,4 @@ +import copy import glob import logging import os @@ -362,7 +363,9 @@ def expanded_dict_from_minion(minion_id, salt_data): node_dict[minion_id] = {} # Merge newly found pillars into existing ones - dict_merge(salt_data["__pillar__"], node_dict[minion_id].get("pillars", {})) + dict_merge( + salt_data["__pillar__"], copy.deepcopy(node_dict[minion_id]).get("pillars", {}) + ) # Get 2 ordered lists: # expanded_classes: A list of all the dicts