From 1201328b00c405420d9169a8303e2b5e95dcae37 Mon Sep 17 00:00:00 2001 From: Alexandre Perrin Date: Thu, 7 Jan 2021 15:51:25 +0100 Subject: [PATCH] cmd/install: don't show usage on install failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this patch, when the install fail (e.g. some validation failed) the usage would be displayed. For example, when the minikube minium version was not met: % go run ./cmd/cilium install 🔮 Auto-detected Kubernetes kind: minikube ✨ Running "minikube" validation checks ❌ Validation test minimum-version failed: minimum version is ">=2.5.2", found version "1.16.0" ℹ️ You can disable the test with --disable-check=minimum-version Error: validation check for kind "minikube" failed: minimum version is ">=2.5.2", found version "1.16.0" Usage: cilium install [flags] Flags: --cluster-name string Name of the cluster --datapath-mode string Cilium version to install --disable-check strings Disable a particular validation check -h, --help help for install --namespace string Namespace to install Cilium into (default "kube-system") --version string Cilium version to install This patch make it so an install step error would not make cobra show the usage. See also https://github.com/spf13/cobra/issues/340 Signed-off-by: Alexandre Perrin --- internal/cli/cmd/install.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/cli/cmd/install.go b/internal/cli/cmd/install.go index 2073c93e9b..c46a98a2cb 100644 --- a/internal/cli/cmd/install.go +++ b/internal/cli/cmd/install.go @@ -32,6 +32,7 @@ func newCmdInstall() *cobra.Command { Long: ``, RunE: func(cmd *cobra.Command, args []string) error { installer := install.NewK8sInstaller(k8sClient, params) + cmd.SilenceUsage = true return installer.Install(context.Background()) }, }