From 1932fed0269f6b6e18dab96307c7535a4e1bd366 Mon Sep 17 00:00:00 2001 From: ssttehrani Date: Thu, 11 Jan 2024 15:39:13 +0330 Subject: [PATCH] refactor: improve error messaging for version command Signed-off-by: ssttehrani --- internal/cli/cmd/version.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/cli/cmd/version.go b/internal/cli/cmd/version.go index 8d0cf77848..960d48830d 100644 --- a/internal/cli/cmd/version.go +++ b/internal/cli/cmd/version.go @@ -45,8 +45,8 @@ func newCmdVersion() *cobra.Command { return nil } version, err := k8sClient.GetRunningCiliumVersion(context.Background(), namespace) - if version == "" || err != nil { - fmt.Printf("cilium image (running): unknown. Unable to obtain cilium version, no cilium pods found in namespace %q\n", namespace) + if err != nil { + fmt.Printf("cilium image (running): unknown. Unable to obtain cilium version. Reason: %s\n", err.Error()) } else { fmt.Printf("cilium image (running): %s\n", version) }