Skip to content

Fix Thorium reg.list crashing on a non-list, non-string value#69692

Open
ggiesen wants to merge 2 commits into
saltstack:3006.xfrom
ggiesen:fix-43364-thorium-reg-int-split
Open

Fix Thorium reg.list crashing on a non-list, non-string value#69692
ggiesen wants to merge 2 commits into
saltstack:3006.xfrom
ggiesen:fix-43364-thorium-reg-int-split

Conversation

@ggiesen

@ggiesen ggiesen commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

salt/thorium/reg.py list_() called add.split(",") whenever add was not a list, so an integer add (e.g. "add: 42" in SLS) raised AttributeError: 'int' object has no attribute 'split'. Fixed by only splitting when add is a str and wrapping any other non-list scalar as [add]. Added tests/pytests/unit/thorium/test_reg.py (new dir + init.py) exercising list_ directly with reg.reg/events dunders set on the module (the saltfactories loader-mock fixture rejects thorium's non-standard reg/events dunders). Verified the shadow import points at the worktree, both tests pass with the fix, and test_list_integer_add fails with the exact reported AttributeError when the fix is reverted. Note: the shared venv's saltfactories log-server plugin hangs at session start and its system-statistics plugin errors, so both were disabled via -p no: for this pure-python unit test.

What issues does this PR fix or reference?

Fixes #43364

Previous Behavior

See #43364.

New Behavior

Fix Thorium reg.list crashing on a non-list, non-string value. 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

reg.list_() called add.split(",") whenever add was not a list, which
raised "AttributeError: 'int' object has no attribute 'split'" when an
integer (or other scalar) was passed via SLS. Only split strings and
wrap any other non-list scalar in a single-element list instead.

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

1 participant