From acfd70a645d10cae5635a17049522b978d951f63 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Wed, 24 Jan 2024 15:05:34 -0700 Subject: [PATCH] Return an error if rename arguments != 2 The original implementation presented a warning if more than two arguments were presented, and didn't handle the case where fewer than two arguments were provided. This change requires precisely two arguments and returns an error otherwise. Signed-off-by: Jonathon Anderson --- internal/app/wwctl/container/rename/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/app/wwctl/container/rename/main.go b/internal/app/wwctl/container/rename/main.go index 1821f748..2d329c30 100644 --- a/internal/app/wwctl/container/rename/main.go +++ b/internal/app/wwctl/container/rename/main.go @@ -11,8 +11,8 @@ import ( ) func CobraRunE(cmd *cobra.Command, args []string) (err error) { - if len(args) > 2 { - wwlog.Warn("rename only requires 2 arguments but you provided %d arguments. Hence, they will be ignored.", len(args)) + if len(args) != 2 { + return fmt.Errorf("rename requires 2 arguments: %d provided", len(args)) } crp := &wwapiv1.ContainerRenameParameter{