Commit bd79674
committed
Fix stale resource cache, specific-name targeting, and add sync_resources
Three bugs fixed and one new feature added:
1. salt '*' test.ping was incorrectly dispatching to resources when
targeting a specific minion by name (e.g. salt 'minion' test.ping).
_resolve_resource_targets now only dispatches to resources for wildcard
glob patterns (* ? [). The master-side _augment_with_resources guard
is updated consistently.
2. Removing a resource type from the pillar and running sync_all left
stale resource IDs in the master cache indefinitely, causing phantom
entries in salt '*' output. Three co-operating fixes:
- _discover_resources now distinguishes "no resources key in pillar"
(preserve opts for config-file deployments) from "resources key
present but empty" (authoritative removal — clear opts).
- _register_resources_with_master no longer short-circuits on an empty
resource dict; it always sends the registration so the master cache
is overwritten with the current (possibly empty) state.
- pillar_refresh re-discovers resources and re-registers with the
master after successfully compiling a new pillar, so a sync_all
picks up removals without requiring a minion restart.
3. _augment_with_resources had no error handling; a cache driver failure
would propagate into check_minions and silently discard all PKI-based
minion IDs. Cache errors are now caught, logged, and degraded
gracefully.
New: saltutil.sync_resources / refresh_resources — explicit resource
sync modelled after sync_modules/refresh_modules. sync_all now includes
ret["resources"] and fires a resource_refresh event that triggers
_discover_resources + _register_resources_with_master on the minion.1 parent 1fced3c commit bd79674
5 files changed
Lines changed: 245 additions & 59 deletions
File tree
- salt
- modules
- utils
- tests/pytests/unit
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
561 | 561 | | |
562 | 562 | | |
563 | 563 | | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
568 | 574 | | |
569 | 575 | | |
570 | 576 | | |
571 | 577 | | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
576 | 581 | | |
| 582 | + | |
577 | 583 | | |
578 | 584 | | |
579 | 585 | | |
| |||
3361 | 3367 | | |
3362 | 3368 | | |
3363 | 3369 | | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
| 3373 | + | |
3364 | 3374 | | |
3365 | 3375 | | |
3366 | | - | |
3367 | | - | |
3368 | 3376 | | |
3369 | 3377 | | |
3370 | 3378 | | |
| |||
3480 | 3488 | | |
3481 | 3489 | | |
3482 | 3490 | | |
| 3491 | + | |
| 3492 | + | |
| 3493 | + | |
| 3494 | + | |
| 3495 | + | |
| 3496 | + | |
3483 | 3497 | | |
3484 | 3498 | | |
3485 | 3499 | | |
| |||
3699 | 3713 | | |
3700 | 3714 | | |
3701 | 3715 | | |
| 3716 | + | |
| 3717 | + | |
| 3718 | + | |
3702 | 3719 | | |
3703 | 3720 | | |
3704 | 3721 | | |
| |||
4461 | 4478 | | |
4462 | 4479 | | |
4463 | 4480 | | |
4464 | | - | |
4465 | | - | |
| 4481 | + | |
| 4482 | + | |
4466 | 4483 | | |
4467 | | - | |
| 4484 | + | |
| 4485 | + | |
| 4486 | + | |
4468 | 4487 | | |
4469 | 4488 | | |
4470 | 4489 | | |
| |||
4500 | 4519 | | |
4501 | 4520 | | |
4502 | 4521 | | |
4503 | | - | |
4504 | | - | |
| 4522 | + | |
| 4523 | + | |
| 4524 | + | |
| 4525 | + | |
| 4526 | + | |
| 4527 | + | |
| 4528 | + | |
| 4529 | + | |
| 4530 | + | |
| 4531 | + | |
| 4532 | + | |
| 4533 | + | |
| 4534 | + | |
4505 | 4535 | | |
4506 | 4536 | | |
4507 | 4537 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
| 405 | + | |
| 406 | + | |
406 | 407 | | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
419 | | - | |
420 | | - | |
421 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
422 | 423 | | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | 424 | | |
429 | | - | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
430 | 432 | | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
451 | 464 | | |
452 | 465 | | |
453 | 466 | | |
| |||
1258 | 1271 | | |
1259 | 1272 | | |
1260 | 1273 | | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
1261 | 1277 | | |
1262 | 1278 | | |
1263 | 1279 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
798 | 798 | | |
799 | 799 | | |
800 | 800 | | |
801 | | - | |
802 | | - | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
803 | 808 | | |
804 | | - | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
805 | 819 | | |
806 | 820 | | |
807 | 821 | | |
808 | 822 | | |
809 | 823 | | |
810 | 824 | | |
811 | 825 | | |
812 | | - | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
813 | 836 | | |
814 | 837 | | |
815 | 838 | | |
| |||
861 | 884 | | |
862 | 885 | | |
863 | 886 | | |
864 | | - | |
865 | 887 | | |
866 | | - | |
| 888 | + | |
867 | 889 | | |
868 | 890 | | |
869 | 891 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
64 | | - | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
232 | 233 | | |
233 | 234 | | |
234 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
0 commit comments