Skip to content

fix: guard against non-iterable target in list_jobs search_target#68862

Open
joaquinhuigomez wants to merge 1 commit intosaltstack:masterfrom
joaquinhuigomez:fix/list-jobs-search-target-iterable
Open

fix: guard against non-iterable target in list_jobs search_target#68862
joaquinhuigomez wants to merge 1 commit intosaltstack:masterfrom
joaquinhuigomez:fix/list-jobs-search-target-iterable

Conversation

@joaquinhuigomez
Copy link
Copy Markdown

When search_target is used in list_jobs, the code assumes Target is always a string or list. Execution and state failures can leave Target as a non-iterable value (e.g. an integer), which causes a TypeError when iterating.

This adds a type check that converts non-iterable, non-string targets to an empty list so they are safely skipped instead of crashing.

Includes a unit test covering the non-iterable target case.

Closes #68780

When search_target is used in list_jobs, the code assumed Target would
always be a string or list. Execution/state failures can leave Target
as a non-iterable value (e.g. int), causing a TypeError. Skip
non-iterable targets instead of crashing.

Closes saltstack#68780
@joaquinhuigomez joaquinhuigomez requested a review from a team as a code owner March 28, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: list_jobs with search_target fails if targets is not iterable

1 participant