Skip to content

Commit fb9e637

Browse files
authored
Validate name in llama stack build (meta-llama#128)
The first time I ran `llama stack build`, I quickly hit enter at the first prompt asking for a name, assuming it would use the default given in the help text. This caused a failure later on that wasn't very obvious. I was using the `docker` format and a blank name caused an invalid tag format that failed the image build. This change adds validation for the `name` parameter to ensure it's not empty before proceeding. Signed-off-by: Russell Bryant <rbryant@redhat.com>
1 parent 53070e3 commit fb9e637

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

llama_stack/cli/stack/build.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ def _run_stack_build_command(self, args: argparse.Namespace) -> None:
199199
if not args.config and not args.template:
200200
if not args.name:
201201
name = prompt(
202-
"> Enter a name for your Llama Stack (e.g. my-local-stack): "
202+
"> Enter a name for your Llama Stack (e.g. my-local-stack): ",
203+
validator=Validator.from_callable(
204+
lambda x: len(x) > 0,
205+
error_message="Name cannot be empty, please enter a name",
206+
),
203207
)
204208
else:
205209
name = args.name

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy