Commit 0a386e9
fix(cli): resolve env var templates before validation in list-deps (#5914)
# What does this PR do?
`ogx stack list-deps` passed raw YAML directly to `StackConfig()`,
causing Pydantic validation errors for non-string fields using env var
syntax (e.g. `registry_refresh_interval_seconds` set to
`${env.REGISTRY_REFRESH_INTERVAL_SECONDS:=300}`).
Use `replace_env_vars()` before validation, matching the server startup
path. This also subsumes the manual `auth` `provider_config` nulling
workaround since `replace_env_vars` already handles that.
Distributions like `nvidia` and `postgres-demo` use bare
`${env.INFERENCE_MODEL}` (no default value) in `registered_resources`.
Since these env vars are not set at build/CI time, `replace_env_vars()`
would raise `EnvVarError`. The new `ignore_unresolved` parameter makes
`list-deps` tolerant of these by resolving bare unset env vars to empty
strings, which triggers the existing resource-skip logic. Server startup
behavior is unchanged (still raises on missing env vars).
## Test plan
- [x] Unit tests for `replace_env_vars` pass (37 tests including 4 new
`ignore_unresolved` tests)
- [x] Unit tests for `list-deps` pass (14 tests)
- [x] `ogx stack list-deps nvidia` succeeds without `INFERENCE_MODEL`
set
- [x] `ogx stack list-deps postgres-demo` succeeds without
`INFERENCE_MODEL` set
- [x] Pre-commit checks pass on all changed files
- [x] `mypy` passes
**Upstream issue**:
opendatahub-io/ogx-distribution#429
---------
Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 6f981ba commit 0a386e9
3 files changed
Lines changed: 59 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 93 | + | |
102 | 94 | | |
103 | 95 | | |
104 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
485 | | - | |
486 | | - | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
487 | 494 | | |
488 | 495 | | |
489 | 496 | | |
| |||
493 | 500 | | |
494 | 501 | | |
495 | 502 | | |
496 | | - | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
497 | 506 | | |
498 | 507 | | |
499 | 508 | | |
500 | 509 | | |
501 | 510 | | |
502 | 511 | | |
503 | 512 | | |
504 | | - | |
| 513 | + | |
505 | 514 | | |
506 | 515 | | |
507 | 516 | | |
| |||
518 | 527 | | |
519 | 528 | | |
520 | 529 | | |
521 | | - | |
| 530 | + | |
522 | 531 | | |
523 | 532 | | |
524 | 533 | | |
| |||
533 | 542 | | |
534 | 543 | | |
535 | 544 | | |
536 | | - | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
537 | 548 | | |
538 | 549 | | |
539 | 550 | | |
| |||
551 | 562 | | |
552 | 563 | | |
553 | 564 | | |
554 | | - | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
555 | 568 | | |
556 | 569 | | |
557 | 570 | | |
| |||
575 | 588 | | |
576 | 589 | | |
577 | 590 | | |
578 | | - | |
| 591 | + | |
579 | 592 | | |
580 | 593 | | |
581 | 594 | | |
| |||
620 | 633 | | |
621 | 634 | | |
622 | 635 | | |
| 636 | + | |
| 637 | + | |
623 | 638 | | |
624 | 639 | | |
625 | 640 | | |
| |||
| 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 | + | |
45 | 79 | | |
46 | 80 | | |
47 | 81 | | |
| |||
0 commit comments