Repository navigation
Commit fe8ca91
committed
Guard the contextvars import for py3.6 salt-ssh; revert thin typing_extensions bundle
The previous commit bundled typing_extensions into the salt-ssh thin, but the
thin ships the build host's (modern) typing_extensions, whose py3.8+ syntax is a
SyntaxError on a Python 3.6 target -- and it shadows the target's own compatible
typing_extensions, so importlib_metadata (imported at salt-call startup via
salt._compat) crashed before reaching any of this PR's code. That broke salt-ssh
on every py3.6 target (Rocky Linux 8, Amazon Linux 2). Reverted.
Instead, guard "import contextvars" in salt/state.py. On targets where it can
only be resolved through the thin's backport -- which drags in
immutables/typing_extensions that may be missing (a py3.9 Debian target) or
incompatible (py3.6) -- catch ImportError/SyntaxError and fall back to a shared
class-level active-HighState stack. salt-ssh runs one execution per target, so
the per-context isolation (#63056) is not needed there; on py3.7+ minions and
the onedir master/minion, stdlib contextvars is used and the isolation is
unchanged.
Validated on live Python 3.6.8 (AlmaLinux 8): a modern typing_extensions is a
SyntaxError on py3.6, and the guarded import catches both that and a missing
typing_extensions, engaging the fallback without crashing.
Adds a test for the fallback path.1 parent cf523c4 commit fe8ca91
4 files changed
Lines changed: 58 additions & 37 deletions
File tree
- salt
- utils
- tests/pytests/unit
- state
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
15 | 24 | | |
16 | 25 | | |
17 | 26 | | |
| |||
3911 | 3920 | | |
3912 | 3921 | | |
3913 | 3922 | | |
| 3923 | + | |
| 3924 | + | |
| 3925 | + | |
| 3926 | + | |
| 3927 | + | |
3914 | 3928 | | |
3915 | 3929 | | |
| 3930 | + | |
| 3931 | + | |
3916 | 3932 | | |
3917 | 3933 | | |
3918 | 3934 | | |
| |||
3934 | 3950 | | |
3935 | 3951 | | |
3936 | 3952 | | |
3937 | | - | |
| 3953 | + | |
| 3954 | + | |
| 3955 | + | |
| 3956 | + | |
3938 | 3957 | | |
3939 | 3958 | | |
3940 | 3959 | | |
| |||
5125 | 5144 | | |
5126 | 5145 | | |
5127 | 5146 | | |
5128 | | - | |
| 5147 | + | |
| 5148 | + | |
| 5149 | + | |
| 5150 | + | |
5129 | 5151 | | |
5130 | 5152 | | |
5131 | 5153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | 44 | | |
56 | 45 | | |
57 | 46 | | |
| |||
463 | 452 | | |
464 | 453 | | |
465 | 454 | | |
466 | | - | |
467 | | - | |
468 | 455 | | |
469 | 456 | | |
470 | 457 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | 488 | | |
494 | 489 | | |
495 | 490 | | |
| |||
517 | 512 | | |
518 | 513 | | |
519 | 514 | | |
520 | | - | |
521 | | - | |
522 | 515 | | |
523 | 516 | | |
524 | 517 | | |
| |||
603 | 596 | | |
604 | 597 | | |
605 | 598 | | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | 599 | | |
612 | 600 | | |
613 | 601 | | |
| |||
637 | 625 | | |
638 | 626 | | |
639 | 627 | | |
640 | | - | |
641 | | - | |
642 | 628 | | |
643 | 629 | | |
644 | 630 | | |
| |||
731 | 717 | | |
732 | 718 | | |
733 | 719 | | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | 720 | | |
740 | 721 | | |
741 | 722 | | |
| |||
765 | 746 | | |
766 | 747 | | |
767 | 748 | | |
768 | | - | |
769 | | - | |
770 | 749 | | |
771 | 750 | | |
772 | 751 | | |
| |||
0 commit comments