mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-29 11:24:19 +00:00
Validate name
in llama stack build
(#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>
This commit is contained in:
parent
53070e34a3
commit
fb9e6371ec
1 changed files with 5 additions and 1 deletions
|
@ -199,7 +199,11 @@ class StackBuild(Subcommand):
|
||||||
if not args.config and not args.template:
|
if not args.config and not args.template:
|
||||||
if not args.name:
|
if not args.name:
|
||||||
name = prompt(
|
name = prompt(
|
||||||
"> Enter a name for your Llama Stack (e.g. my-local-stack): "
|
"> Enter a name for your Llama Stack (e.g. my-local-stack): ",
|
||||||
|
validator=Validator.from_callable(
|
||||||
|
lambda x: len(x) > 0,
|
||||||
|
error_message="Name cannot be empty, please enter a name",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
name = args.name
|
name = args.name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue