Skip to content

[WIP] [3006.x] Initial re-do of changes for _sync_grains only affecting masterless minions - #66737

Open
dmurphy18 wants to merge 2 commits into
saltstack:3008.xfrom
dmurphy18:fix_65027a
Open

dmurphy18 wants to merge 2 commits into
saltstack:3008.xfrom
dmurphy18:fix_65027a

Conversation

@dmurphy18

Copy link
Copy Markdown
Contributor

What does this PR do?

Ensures that grains are sync'd before loading grains and then compiling pillar, since there could be custom grains used in pillar files, which will throw rendering errors if not found, when in masterless mode on a salt-minion

Rework of accidentally closed PR 65792

What issues does this PR fix or reference?

Fixes: #65027

Previous Behavior

Would throw rendering errors if custom grains in salt://_grains were used in pillar files, salt-minion in masterless mode.

New Behavior

No rendering errors thrown if custom grains in salt://_grains were used in pillar files, and custom grains values available in pillar, and salt-minion in masterless mode.

Additional tests to be written ensuring use with a salt-master is unaffected.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices, including the
PR Guidelines.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@dmurphy18 dmurphy18 self-assigned this Jul 23, 2024
@dmurphy18
dmurphy18 requested a review from a team as a code owner July 23, 2024 15:46
@dmurphy18 dmurphy18 added this to the Sulfur v3006.10 milestone Aug 14, 2024
@dmurphy18 dmurphy18 added the test:slow Enable Slow Tests label Aug 14, 2024
@twangboy

twangboy commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

We are not longer accepting bugfixes on the 3006.x branch. Please rebase this against the 3008.x branch.

twangboy and others added 2 commits November 4, 2026 16:28
clean overrides the clean_dynamic_modules option for a single call:
False only adds and updates modules, True also removes any that are not
in the file roots, and None (the default) keeps using the option.

This lets a caller that syncs implicitly avoid deleting modules it does
not own, whatever clean_dynamic_modules is set to.

Refs saltstack#65027
A masterless minion compiles pillar before anything has run
saltutil.sync_grains, so pillar that referenced a custom grain from
salt://_grains failed to render on the first run.

SMinion now syncs _grains from every environment in file_roots before it
loads grains, when file_client is local. The sync only adds and updates
grains and never removes any, whatever clean_dynamic_modules says, so
grains shipped by salt-ssh into extension_modules survive.

The sync runs against a throwaway cachedir. The fileserver caches file
lists per environment and backend rather than per set of roots, so a list
cached for the target's default file_roots was served to later readers of
the same cachedir. On a salt-ssh target that made file.recurse find
nothing from salt://, and state.single over salt-ssh packed no files when
the master and the target shared a filesystem.

Based on the approach in the original change for this issue. Adds a
salt-ssh regression test for file.recurse from salt://.

Fixes saltstack#65027

Co-authored-by: Daniel A. Wozniak <daniel.wozniak@broadcom.com>

This branch was previously deployed

1 inactive deployment
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.

[BUG] state.apply fails if pillar uses custom grain from _grains

3 participants