Commit fe0eef4
committed
Align sshresource_state with upstream relenv improvements
The salt-ssh relenv work merged into master introduced three changes that
required corresponding updates in our SSH resource module:
1. Single.cmd_block() now calls mod_data(self.fsclient) unconditionally to
regenerate extension modules before every remote execution. Passing
fsclient=None (the default) crashes immediately at fsclient.opts.
_exec_state_pkg() now creates a fresh FSClient from the cached master
opts and passes it via the fsclient= kwarg to Single.
2. Single.__init__ renames thin_dir from the default *_salt suffix to
*_salt_relenv when relenv=True, then writes the updated path back into
opts["thin_dir"]. The previous code built the state.pkg argv string
before constructing Single, so the baked-in path diverged from where
the state tar was actually sent. The argv is now set after __init__
so both the send path and the command string use the finalized
thin_dir.
3. _relenv_path() hardcoded linux/x86_64, which would silently deploy the
wrong tarball to arm64 hosts. It now probes x86_64 then arm64 and
returns the first path that exists locally, or None. A None return
tells Single.__init__ to call detect_os_arch() itself — one extra SSH
round-trip as a fallback, but always correct.
Also removes the leftover debug echo from SSH_SH_SHIM_RELENV that was
writing SALT_CALL_CMD diagnostics to stderr on every remote execution.
Tests added: TestRelenvPath (4 cases), fsclient mock added to all
_exec_state_pkg test helpers, and test_single_receives_fsclient verifies
the kwarg is threaded through.1 parent fac401f commit fe0eef4
3 files changed
Lines changed: 114 additions & 12 deletions
File tree
- salt
- client/ssh
- modules
- tests/pytests/unit/modules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | 280 | | |
284 | 281 | | |
285 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
79 | 87 | | |
80 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
81 | 93 | | |
82 | 94 | | |
83 | 95 | | |
| |||
429 | 441 | | |
430 | 442 | | |
431 | 443 | | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
432 | 449 | | |
| 450 | + | |
433 | 451 | | |
434 | 452 | | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | 453 | | |
442 | 454 | | |
443 | | - | |
| 455 | + | |
444 | 456 | | |
445 | 457 | | |
446 | 458 | | |
| 459 | + | |
447 | 460 | | |
448 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
449 | 471 | | |
450 | 472 | | |
451 | 473 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
45 | 83 | | |
46 | 84 | | |
47 | 85 | | |
| |||
139 | 177 | | |
140 | 178 | | |
141 | 179 | | |
| 180 | + | |
| 181 | + | |
142 | 182 | | |
143 | 183 | | |
144 | 184 | | |
| |||
200 | 240 | | |
201 | 241 | | |
202 | 242 | | |
| 243 | + | |
| 244 | + | |
203 | 245 | | |
204 | 246 | | |
205 | 247 | | |
| |||
242 | 284 | | |
243 | 285 | | |
244 | 286 | | |
| 287 | + | |
| 288 | + | |
245 | 289 | | |
246 | 290 | | |
247 | 291 | | |
| |||
276 | 320 | | |
277 | 321 | | |
278 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
0 commit comments