Skip to content

fix: import salt.utils.jid explicitly in pgjsonb returner (#69042)#69128

Open
SAY-5 wants to merge 1 commit into
saltstack:masterfrom
SAY-5:say5/pgjsonb-import-utils-jid-69042
Open

fix: import salt.utils.jid explicitly in pgjsonb returner (#69042)#69128
SAY-5 wants to merge 1 commit into
saltstack:masterfrom
SAY-5:say5/pgjsonb-import-utils-jid-69042

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 12, 2026

What does this PR do?

Restores the explicit import salt.utils.jid in the pgjsonb returner. The module calls salt.utils.jid.gen_jid() in prep_jid() (line 461) and salt.utils.jid.format_jid_instance() in get_jids() (line 436), but currently only imports salt.utils.data and salt.utils.job. The salt.utils.jid reference works today as a side effect of salt.utils.args being loaded transitively via salt.utils.data. Any refactor of that import chain silently breaks pgjsonb with AttributeError: module 'salt.utils' has no attribute 'jid'.

prep_jid() is called from master.py:_prep_jid() on every job publish. That caller only handles KeyError, TypeError so the latent AttributeError would propagate and prevent the master from publishing jobs when master_job_cache: pgjsonb is in use.

A regression test in tests/pytests/unit/returners/test_pgjsonb.py asserts that salt.utils.jid is reachable through the module's globals so future refactors can no longer drop the explicit import.

What issues does this PR fix or reference?

Fixes #69042

Previous Behavior

prep_jid / get_jids worked only because salt.utils.jid was loaded transitively. In an interpreter where it had not been loaded yet, both functions raised AttributeError: module 'salt.utils' has no attribute 'jid'.

New Behavior

The explicit import salt.utils.jid is restored alongside the existing salt.utils.data / salt.utils.job imports, so both call sites resolve regardless of which other modules have been imported beforehand.

Merge requirements satisfied?

  • Docs
  • Changelog - changelog/69042.fixed.md
  • Tests written/updated

Commits signed with GPG?

No

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.

[Bug]: pgjsonb returner uses salt.utils.jid without importing it (latent AttributeError)

2 participants