llama-stack/llama_stack/cli/stack
Alexey Rybak 8f57b08f2c
fix(build): always pass path when no template/config provided (#1982)
# What does this PR do?

Fixes a crash that occurred when building a stack as a container image
via the interactive wizard without supplying --template or --config.

- Root cause: template_or_config was None; only the container path
relies on that parameter, which later reaches subprocess.run() and
triggers

`TypeError: expected str, bytes or os.PathLike object, not NoneType.`

- Change: in `_run_stack_build_command_from_build_config` we now fall
back to the freshly‑written build‑spec file whenever both optional
sources are missing. Also adds a spy‑based unit test that asserts a
valid string path is passed to build_image() for container builds.

### Closes #1976

## Test Plan

- New unit test: test_build_path.py. Monkey‑patches build_image,
captures the fourth argument, and verifies it is a real path
- Manual smoke test: 

```
llama stack build --image-type container
# answer wizard prompts

```

Build proceeds into Docker without raising the previous TypeError.

## Future Work
Harmonise `build_image` arguments so every image type receives the same
inputs, eliminating this asymmetric special‑case.
2025-04-17 10:20:43 +02:00
..
__init__.py API Updates (#73) 2024-09-17 19:51:35 -07:00
_build.py fix(build): always pass path when no template/config provided (#1982) 2025-04-17 10:20:43 +02:00
build.py feat: add --providers to llama stack build (#1718) 2025-04-15 14:17:03 +02:00
list_apis.py API Updates (#73) 2024-09-17 19:51:35 -07:00
list_providers.py feat: support listing all for llama stack list-providers (#1056) 2025-02-12 22:03:28 -08:00
run.py fix: misleading help text for 'llama stack build' and 'llama stack run' (#1910) 2025-04-12 01:19:11 -07:00
stack.py fix: Incorrect import path for print_subcommand_description() (#1314) 2025-02-27 18:35:49 -08:00
utils.py fix: Use CONDA_DEFAULT_ENV presence as a flag to use conda mode (#1555) 2025-03-27 17:13:22 -04:00