Commit b7081f5
committed
fix(logging): tolerate unset options dict in worker bootstrap
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 #68332
Signed-off-by: Teddy Andrieux <teddy.andrieux@scality.com>1 parent 86fc641 commit b7081f5
4 files changed
Lines changed: 36 additions & 1 deletion
File tree
- changelog
- salt/_logging
- tests/pytests
- functional/utils
- unit/_logging
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
| 437 | + | |
| 438 | + | |
437 | 439 | | |
438 | 440 | | |
439 | 441 | | |
| |||
969 | 971 | | |
970 | 972 | | |
971 | 973 | | |
972 | | - | |
| 974 | + | |
973 | 975 | | |
974 | 976 | | |
975 | 977 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
0 commit comments