Skip to content

Warn when salt-call --file-root/--pillar-root/--states-dir ignored (#68137)#69434

Open
dwoz wants to merge 1 commit into
saltstack:3006.xfrom
dwoz:fix/issue-68137
Open

Warn when salt-call --file-root/--pillar-root/--states-dir ignored (#68137)#69434
dwoz wants to merge 1 commit into
saltstack:3006.xfrom
dwoz:fix/issue-68137

Conversation

@dwoz

@dwoz dwoz commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

salt-call accepted --file-root, --pillar-root, and --states-dir
without --local but silently dropped the overrides — the remote file
client retrieves state and pillar data from the master and
HighState.__gen_opts() overwrites file_roots with the master's
values. Now the CLI emits a single stderr warning naming the ignored
option(s) and pointing the user at --local. The underlying config
keys are still populated so behaviour with --local is unchanged.

What issues does this PR fix or reference?

Fixes #68137

Previous Behavior

$ salt-call state.apply network.hosts --file-root=/root/test_states

ran against the master's /srv/salt with no indication that
--file-root had no effect.

New Behavior

$ salt-call state.apply network.hosts --file-root=/root/test_states
Warning: --file-root is ignored because --local was not specified;
the remote file client retrieves these from the master. Re-run with
--local to use the local override.

Merge requirements satisfied?

  • Docs (existing doc/ref/cli/salt-call.rst text matches the new
    behaviour; option still does what it says when --local is set)
  • Changelog (changelog/68137.fixed.md)
  • Tests written/updated (tests/pytests/unit/cli/test_call.py,
    five new tests covering each option plus negative cases)

Commits signed with GPG?

No

salt-call's --file-root, --pillar-root, and --states-dir options
silently had no observable effect when --local was not also passed.
These flags only update the local minion's file_roots, pillar_roots,
and states_dirs config; the remote file client then retrieves state
and pillar data from the master and HighState.__gen_opts() in
salt/state.py overwrites the local file_roots with master_opts'
file_roots, so the user-supplied directories were ignored without
any indication.

Emit a single stderr warning naming the ignored option(s) and
pointing the user at --local. No control-flow changes; the underlying
config keys are still populated so behaviour with --local is
unchanged.

Fixes saltstack#68137
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.

1 participant