Skip to content

fix(logging): tolerate unset options dict in worker bootstrap#69081

Merged
dwoz merged 1 commit into
saltstack:3006.xfrom
TeddyAndrieux:bugfix/none-opts-when-set-logging
Jun 22, 2026
Merged

fix(logging): tolerate unset options dict in worker bootstrap#69081
dwoz merged 1 commit into
saltstack:3006.xfrom
TeddyAndrieux:bugfix/none-opts-when-set-logging

Conversation

@TeddyAndrieux

@TeddyAndrieux TeddyAndrieux commented May 7, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

CLI parsers seed salt._logging's global options dict at startup via LogLevelMixIn.__setup_logging_config(). Non-CLI consumers (RunnerClient.asynchronous, SSHClient, salt.utils.process.Process subclasses, parallel states) have no parser, so the dict stays None.

Process.new snapshots that None into instance.logging_config; wrapped_run_func then calls set_logging_options_dict(None) defensively, which forwards to set_lowest_log_level_by_opts(None).get(...) and AttributeErrors on the worker. The parent exits 0 with a misleading "Target did not return any data" / dead jid / 'result': None.

Make set_logging_options_dict(None) and setup_logging() (when nothing has been seeded) no-op gracefully. Workers fall back to whatever logger configuration they inherited from the parent. CLI tools always seed before calling and are unaffected.

What issues does this PR fix or reference?

Fixes #68332

Previous Behavior

When using salt without CLI (using python API) some call throw errors during setup_logging phase.

New Behavior

No more error when setting up logging when using salt with python directly

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

@twangboy twangboy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create this against 3006.x branch.

@TeddyAndrieux

Copy link
Copy Markdown
Contributor Author

Please create this against 3006.x branch.

Ok I can do it, I thought we were supposed to merge first in master and then backport in other branches if need to, I will switch to 3006

@TeddyAndrieux TeddyAndrieux force-pushed the bugfix/none-opts-when-set-logging branch from 89f484d to b7081f5 Compare June 19, 2026 06:56
@TeddyAndrieux TeddyAndrieux changed the base branch from master to 3006.x June 19, 2026 06:56
@dwoz dwoz added the test:full Run the full test suite label Jun 19, 2026
CLI parsers seed salt._logging's global options dict at startup via
LogLevelMixIn.__setup_logging_config(). Non-CLI consumers
(RunnerClient.asynchronous, SSHClient, salt.utils.process.Process
subclasses, parallel states) have no parser, so the dict stays None.

Process.__new__ snapshots that None into instance.__logging_config__;
wrapped_run_func then calls set_logging_options_dict(None) defensively,
which forwards to set_lowest_log_level_by_opts(None).get(...) and
AttributeErrors on the worker. The parent exits 0 with a misleading
"Target did not return any data" / dead jid / 'result': None.

Make set_logging_options_dict(None) and setup_logging() (when nothing
has been seeded) no-op gracefully. Workers fall back to whatever logger
configuration they inherited from the parent. CLI tools always seed
before calling and are unaffected.

Fixes saltstack#68332

Signed-off-by: Teddy Andrieux <teddy.andrieux@scality.com>
@dwoz dwoz merged commit c554f13 into saltstack:3006.x Jun 22, 2026
851 of 854 checks passed
@TeddyAndrieux TeddyAndrieux deleted the bugfix/none-opts-when-set-logging branch June 22, 2026 05:17
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]: RunnerClient.asynchronous throws exception

3 participants