Repository navigation
Conversation
twangboy
force-pushed
the
fix/70618-lazyavailstates-ignore-env-order
branch
from
November 5, 2026 23:48
fd5b3d2 to
e78edb9
Compare
twangboy
previously approved these changes
Nov 5, 2026
twangboy
approved these changes
Nov 11, 2026
…ack#70618) LazyAvailStates builds the list of available saltenvs from BaseHighState._get_envs(), which, when env_order is configured, returns only the environments listed in env_order. Fileserver environments that are not (and cannot be) listed there, such as gitfs branches exposed through gitfs_saltenv_whitelist, were therefore reported as "No matching salt environment for environment '...' found" by render_highstate, even though the master served them. Add a restrict_to_env_order argument to _get_envs() (default True, so top file evaluation in get_tops is unchanged) and have LazyAvailStates ask for the unrestricted list. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…stack#70618) Covers the end-to-end path through ``state.show_sls`` and ``state.sls`` for an environment that is served by the fileserver but not listed in ``env_order``. The existing unit tests exercise ``BaseHighState._get_envs`` and ``LazyAvailStates._fill`` in isolation; this integration test stands up a real master + minion whose ``env_order`` is intentionally narrower than its ``file_roots``, which is the configuration that reproduced the bug on 3008.x. Pre-fix behaviour (reproduced on origin/3008.x f5180cd) is:: salt-call state.show_sls mystate saltenv=feature_branch -> ["No matching salt environment for environment 'feature_branch' found"] Post-fix the same call returns the rendered high-state. The suite also asserts that envs inside ``env_order`` still render, and that a truly unknown saltenv still produces the diagnostic so the fix does not silently accept every env.
va000612
force-pushed
the
fix/70618-lazyavailstates-ignore-env-order
branch
from
November 12, 2026 06:06
ba80953 to
62640a4
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes
No matching salt environment for environment '...' foundbeing reported for fileserver environments that are not listed inenv_order.LazyAvailStatesbuilds the list of available saltenvs fromBaseHighState._get_envs(). Whenenv_orderis configured,_get_envs()returns only the environments listed inenv_order, so any other environment on the fileserver is treated as unknown byrender_highstate. This hits gitfs branches exposed throughgitfs_saltenv_whitelist(for examplefeature/.*), which can't be listed statically inenv_order. The master serves them correctly.fileserver.envs,fileserver.file_listandcp.list_statesall show the env, and the sls is still rendered, but every run reports the error.The fix:
_get_envs()takes a newrestrict_to_env_orderargument, defaultTrue, so existing behavior is unchanged.get_topsstill uses it to order and limit top-file evaluation.LazyAvailStates._fillcalls_get_envs(restrict_to_env_order=False), so every environment known to the fileserver counts as available.What issues does this PR fix or reference?
Fixes: #70618
Previous Behavior
With
env_order: [base, prod, staging, dev]andgitfs_saltenv_whitelist: [prod, staging, dev, 'feature/.*'], runningsalt-call state.show_sls mystate saltenv=feature/myfeaturereturnedNo matching salt environment for environment 'feature/myfeature' found, althoughsalt-run fileserver.envslisted the branch.New Behavior
The same command renders the sls with no error. Envs inside
env_orderbehave as before, and an env that does not exist on the fileserver still errors.Merge requirements satisfied?
changelog/70618.fixed.mdtests/pytests/unit/state/test_lazy_avail_states.pyTesting
Unit tests (
pytest --core-tests):tests/pytests/unit/state/test_lazy_avail_states.py(new, 4 tests):_get_envs()is still limited toenv_orderby default; the unrestricted call includes envs outsideenv_order; an empty fileserver env list falls back toenv_order;LazyAvailStatesaccepts an env outsideenv_orderand still rejects a non-existent one.tests/pytests/unit/state/test_state_options.py: 5 passed together with the above.Manual reproduction and verification (master and minion, Salt 3008.5, Python 3.11, Rocky 8.10,
gitfs_provider: gitpython,ssh://remote):Config:
gitfs_saltenv_whitelist: [prod, staging, dev, 'feature/.*']
env_order: [base, prod, staging, dev]
top_file_merging_strategy: merge_all
After pushing a new branch
feature/sevenand runningsalt-run fileserver.update:salt-run fileserver.envsfeature/sevensalt-run fileserver.file_list saltenv=feature/sevenmystate/init.slssalt-call state.show_sls mystate saltenv=feature/sevensalt '<minion>' state.show_sls mystate saltenv=feature/sevenshow_sls ... saltenv=prod(inenv_order)show_sls ... saltenv=doesnotexistWithout
env_orderthe same setup rendered correctly before the patch (3008.4 pygit2 and GitPython, 3008.5 GitPython), which isolatesenv_orderas the cause.Commits signed with GPG?
No