Skip to content

Extpillar nodegroups support lists - #69084

Open
oeko2002 wants to merge 4 commits into
saltstack:3006.xfrom
oeko2002:extpillar_nodegroups_support_lists
Open

oeko2002 wants to merge 4 commits into
saltstack:3006.xfrom
oeko2002:extpillar_nodegroups_support_lists

Conversation

@oeko2002

@oeko2002 oeko2002 commented May 7, 2026

Copy link
Copy Markdown

What does this PR do?

Supporting of YAML lists for the nodegroups ext_pillar

What issues does this PR fix or reference?

#55146

Previous Behavior

Nodegroups formed as YAML list

nodegroups:
  mynodegroup:
    - host1
    - host2

fail to parse as ext_pillar nodegroups, resulting in ERROR logs:

2026-05-06 12:47:54,667 [salt.utils.minions:616 ][DEBUG   ][528] Evaluating final compound matching expr: {'host1'} {'host2'} 
2026-05-06 12:47:54,668 [salt.utils.minions:621 ][ERROR   ][528] Invalid compound target: ['host1', 'host2']

New Behavior

Parsing works:

2026-05-06 12:47:55,097 [salt.utils.minions:616 ][DEBUG   ][528] Evaluating final compound matching expr: {'host1', 'host2'}
2026-05-06 12:47:55,100 [salt.utils.minions:482 ][DEBUG   ][528] minions: {'host1', 'host2'}

Merge requirements satisfied?

Commits signed with GPG?

No

@oeko2002
oeko2002 requested a review from a team as a code owner May 7, 2026 07:49
@oeko2002
oeko2002 requested review from sujitdb and removed request for a team May 7, 2026 07:49
@welcome

welcome Bot commented May 7, 2026

Copy link
Copy Markdown

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here's some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at saltproject.pdl@broadcom.com. We're glad you've joined our community and look forward to doing awesome things with you!

@dwoz
dwoz changed the base branch from 3005.x to 3006.x May 7, 2026 10:39
@dwoz
dwoz requested a review from a team as a code owner May 7, 2026 10:39
@dwoz dwoz added test:full Run the full test suite labels May 7, 2026
@dwoz

dwoz commented May 7, 2026

Copy link
Copy Markdown
Contributor

@oeko2002 This needs to go into 3006.x. I've took the liberty of changing the base branch but there are conflicts that need to be resolved.

@oeko2002
oeko2002 force-pushed the extpillar_nodegroups_support_lists branch from 3bc38c4 to ed808f3 Compare May 7, 2026 12:11
@oeko2002

oeko2002 commented May 7, 2026

Copy link
Copy Markdown
Author

Ok, rebased to 3006.x branch :D

@oeko2002

Copy link
Copy Markdown
Author

Adjusted the tests

@oeko2002

Copy link
Copy Markdown
Author

Anything I need to do?

Comment thread salt/pillar/nodegroups.py
ckminions = None
for nodegroup_name in all_nodegroups.keys():
ckminions = ckminions or CkMinions(__opts__)
all_nodegroups[nodegroup_name] = nodegroup_comp(nodegroup_name, all_nodegroups)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While using nodegroup_comp is the correct approach to flatten the list, modifying all_nodegroups[nodegroup_name] in-place mutates the global opts["nodegroups"] structure during the master's runtime. This can cause unexpected side effects for other parallel operations or subsequent lookups that expect the raw definition.

Suggested Change:
Assign the expanded group string to a local variable instead:

group_expr = nodegroup_comp(nodegroup_name, all_nodegroups)
_res = ckminions.check_minions(group_expr, "compound")

if not isinstance(group_sel, list):
group_sel = [group_sel]
if any(x for x in group_sel if x.find(fake_minion_id) != -1):
return {"minions": [fake_minion_id], "missing": []}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In production, nodegroup_comp returns a compressed compound match string (e.g., L@minion1,minion2). Because of this, group_sel will never actually be a list at runtime. Forcing it into a list here (group_sel = [group_sel]) causes the test to pass green, but it masks the real string-matching behavior of the code.

Suggested Change:
Update the mock side-effect to directly evaluate the string returned by nodegroup_comp:

        def _side_effect(group_sel, t):
            # group_sel is a compound string here, not a list
            if fake_minion_id in group_sel:
                return {"minions": [fake_minion_id], "missing": []}
            return {"minions": ["another_minion_id"], "missing": []}

@twangboy

twangboy commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

We are no longer accepting Bugfix releases on the 3006.x branch. Please rebase this on the 3008.x branch.

This branch was previously deployed

1 inactive deployment
ci — cb617b90 Deployed Jun 15, 2026 by oeko2002 via Build Onedir Packages / RPM (x86_64) #23194
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants