diff --git a/changelog/55146.fixed.md b/changelog/55146.fixed.md new file mode 100644 index 000000000000..6ff8a469768c --- /dev/null +++ b/changelog/55146.fixed.md @@ -0,0 +1,2 @@ +Flatten yaml node lists to `L@` or `E@` before trying to do the ext_pillar parsing. +For nested Nodegroups this is already done, but on the first level nodegroup a list will fail parsing as compound match. diff --git a/salt/pillar/nodegroups.py b/salt/pillar/nodegroups.py index 29642c4acf00..4a70c6d5de9e 100644 --- a/salt/pillar/nodegroups.py +++ b/salt/pillar/nodegroups.py @@ -35,7 +35,7 @@ # Import futures -from salt.utils.minions import CkMinions +from salt.utils.minions import CkMinions, nodegroup_comp __version__ = "0.0.2" @@ -56,6 +56,7 @@ def ext_pillar(minion_id, pillar, pillar_name=None): ckminions = None for nodegroup_name in all_nodegroups.keys(): ckminions = ckminions or CkMinions(__opts__) + all_nodegroups[nodegroup_name] = nodegroup_comp(nodegroup_name, all_nodegroups) _res = ckminions.check_minions(all_nodegroups[nodegroup_name], "compound") match = _res["minions"] diff --git a/tests/pytests/unit/pillar/test_nodegroups.py b/tests/pytests/unit/pillar/test_nodegroups.py index 2c4d1bf24311..7732e702ea99 100644 --- a/tests/pytests/unit/pillar/test_nodegroups.py +++ b/tests/pytests/unit/pillar/test_nodegroups.py @@ -14,6 +14,7 @@ def fake_nodegroups(fake_minion_id): return { "groupA": fake_minion_id, "groupB": "another_minion_id", + "groupC": [fake_minion_id, "another_minion_id"] } @@ -48,5 +49,5 @@ def _side_effect(group_sel, t): def test_succeeds(fake_pillar_name, fake_minion_id): - ret = {fake_pillar_name: ["groupA"]} + ret = {fake_pillar_name: ["groupA", "groupC"]} _runner(ret, fake_minion_id, fake_pillar_name)