From c70ca8344fb495b361503b38e8fde0deb23c682a Mon Sep 17 00:00:00 2001 From: Ignas Baranauskas Date: Tue, 3 Jun 2025 22:39:12 +0100 Subject: [PATCH] fix: resolve template name to config path in `llama stack run` (#2361) # What does this PR do? This PR fixes a bug where running a known template by name using: `llama stack run ollama` would fail with the following error: `ValueError: Config file ollama does not exist` Closes #2291 ## Test Plan `llama stack run ollama` should work --- llama_stack/cli/stack/run.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/llama_stack/cli/stack/run.py b/llama_stack/cli/stack/run.py index 387d913e9..2f768957d 100644 --- a/llama_stack/cli/stack/run.py +++ b/llama_stack/cli/stack/run.py @@ -35,7 +35,8 @@ class StackRun(Subcommand): "config", type=str, nargs="?", # Make it optional - help="Path to config file to use for the run. Required for venv and conda environments.", + metavar="config | template", + help="Path to config file to use for the run or name of known template (`llama stack list` for a list).", ) self.parser.add_argument( "--port", @@ -154,7 +155,10 @@ class StackRun(Subcommand): # func=> if callable(getattr(args, arg)): continue - setattr(server_args, arg, getattr(args, arg)) + if arg == "config" and template_name: + server_args.config = str(config_file) + else: + setattr(server_args, arg, getattr(args, arg)) # Run the server server_main(server_args)