Skip to content

[DOCS] state_top_saltenv documention is inaccurate in regard to when it applies #66587

Closed as not planned

Description

@Sxderp

Description

This option has no default value. Set it to an environment name to ensure that only the top file from that environment is considered during a highstate.

The docs here are wrong. The "ensure that only the top file from that environment is considered" is only applicable if saltenv is not specified by the minion.

salt/salt/state.py

Lines 3892 to 3920 in 29b6843

if self.opts["saltenv"]:
contents = self.client.cache_file(
self.opts["state_top"], self.opts["saltenv"]
)
if contents:
found = 1
tops[self.opts["saltenv"]] = [
compile_template(
contents,
self.state.rend,
self.state.opts["renderer"],
self.state.opts["renderer_blacklist"],
self.state.opts["renderer_whitelist"],
saltenv=self.opts["saltenv"],
context=context,
)
]
else:
tops[self.opts["saltenv"]] = [{}]
else:
found = 0
state_top_saltenv = self.opts.get("state_top_saltenv", False)
if state_top_saltenv and not isinstance(state_top_saltenv, str):
state_top_saltenv = str(state_top_saltenv)
for saltenv in (
[state_top_saltenv] if state_top_saltenv else self._get_envs()
):

Suggested Fix
Update the docs to indicate that it will only apply if the minion does not have a saltenv configured. I believe this setting is more accurately described as a saltenv fallback, as it behaves very similar to if saltenv was configured.

Location or format of documentation
https://docs.saltproject.io/en/latest/ref/configuration/master.html#state-top-saltenv
https://docs.saltproject.io/en/latest/ref/configuration/minion.html#state-top-saltenv

Additional context
I actually like the way the option currently works. I do /not/ believe it should be changed.

Activity

  1. added
    documentation
    on May 23, 2024
  2. added this to the Potassium v3009.0 milestone on Jun 25, 2026
  3. dwoz commented on Oct 28, 2026

    @dwoz
    Contributor

    Closing — consolidated into #70585. The checkbox for this item is in the appropriate theme section of that tracker. Please pick up the sub-item there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentation

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions