Commit 59776ab
committed
apply: resolve the release up front
Collection expansion can now filter on the release, but nothing supplies
one. Resolve it in take_action and pass it down, with --openstack-version
overriding the versions file.
The resolution happens before the dispatch loop, not inside it. That
loop iterates the //-separated entries and each handle_collection call
ends in apply_async(), so resolving per entry would let
"osism apply collection-monitoring//nutshell" schedule monitoring and
only then fail on nutshell, having already touched the cluster. Done up
front, a failed resolution schedules nothing at all, and the release is
resolved exactly once, so every entry and every level of the recursion
sees the same value even if the versions file changes mid-run.
The lookup is skipped entirely for collections that contain no bounded
roles, which is eight of the eleven, so such a command cannot fail on
any of this. When it is needed and fails, the three causes are reported
differently -- an unparseable value is already a sentence and is printed
as is, while a missing file or key is appended to one naming the
affected collections -- followed by the roles that needed the release
and how to supply it. The advice names no file to edit: the versions
file belongs to the kolla-ansible container, so the two ways an operator
can supply a release are the environment variable and the flag.
--openstack-version deliberately does not default from the environment
the way sync.py does: openstack_release already consults it, and reading
it here would make the override always truthy. Nor does it default to a
release, which would be the silent guess this all exists to avoid. Note
that argparse.REMAINDER on the trailing arguments swallows any flag
placed after the collection name, so both the help text and the error
advice lead with the environment variable, which is order-independent.
Bounds stay out of the single-role path: "osism apply <role>" never
consults them, because a bound is collection membership and not a claim
that the play exists.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Roger Luethi <luethi@osism.tech>1 parent b045b68 commit 59776ab
2 files changed
Lines changed: 361 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
110 | 123 | | |
111 | 124 | | |
112 | 125 | | |
| |||
329 | 342 | | |
330 | 343 | | |
331 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
332 | 388 | | |
333 | 389 | | |
334 | 390 | | |
| |||
502 | 558 | | |
503 | 559 | | |
504 | 560 | | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
505 | 576 | | |
506 | 577 | | |
507 | 578 | | |
| |||
529 | 600 | | |
530 | 601 | | |
531 | 602 | | |
| 603 | + | |
532 | 604 | | |
533 | 605 | | |
534 | 606 | | |
| |||
0 commit comments