Skip to content

Fix minionfs raising when the minions cache dir is absent#69695

Open
ggiesen wants to merge 3 commits into
saltstack:3006.xfrom
ggiesen:fix-50351-minionfs-salt-ssh
Open

Fix minionfs raising when the minions cache dir is absent#69695
ggiesen wants to merge 3 commits into
saltstack:3006.xfrom
ggiesen:fix-50351-minionfs-salt-ssh

Conversation

@ggiesen

@ggiesen ggiesen commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

salt/fileserver/minionfs.py called os.listdir(minions_cache_dir) unguarded in file_list (line 241) and dir_list (lines 317/337); under the salt-ssh shim the master cachedir is a fresh temp dir with no 'minions' subdir, so both raised FileNotFoundError and killed state.highstate. Fix guards each function: if the minions cache directory does not exist, log.debug and return []. Verified against the bug: with the guard removed both functions raise FileNotFoundError, and with it they return [] (shadow-import of the worktree salt confirmed, salt.file inside the worktree).

What issues does this PR fix or reference?

Fixes #50351

Previous Behavior

See #50351.

New Behavior

Fix minionfs raising when the minions cache dir is absent. Validated by a unit test proven to fail on unpatched 3006.x and pass with the fix (confirmed by adversarial review).

Merge requirements satisfied?

  • Tests written/updated
  • Changelog

Commits signed with GPG?

No

Under the salt-ssh shim the master cachedir is a fresh temp dir with no
'minions' subdirectory, so file_list and dir_list called
os.listdir(minions_cache_dir) on a non-existent path and raised
FileNotFoundError, killing state.highstate. Guard the listdir calls by
returning an empty list when the minions cache directory does not exist.

Fixes saltstack#50351
…cache dir

The direct tests call minionfs.file_list and minionfs.dir_list with the exact
load shape production sends (fileclient always includes a prefix and cmd key
alongside saltenv), using a non-empty prefix since the prefix handling sits
below the os.listdir() call that used to raise when the cache dir was absent.
The inverse tests guard against overcorrection: with an existing, populated
minions cache dir, both functions must still return the pushed files and
directories rather than short-circuiting to an empty list.
@dwoz dwoz added the test:full Run the full test suite label Jul 7, 2026
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.

2 participants