Commit 89f484d
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 5b1e6b4 commit 89f484d
4 files changed
Lines changed: 42 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 | |
|---|---|---|---|
| |||
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
| 452 | + | |
| 453 | + | |
452 | 454 | | |
453 | 455 | | |
454 | 456 | | |
| |||
999 | 1001 | | |
1000 | 1002 | | |
1001 | 1003 | | |
1002 | | - | |
| 1004 | + | |
1003 | 1005 | | |
1004 | 1006 | | |
1005 | 1007 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
0 commit comments