From 6a67ba947a2c5b81c2c373e4122943d82e7c3c17 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Thu, 27 Aug 2020 07:06:54 -0400 Subject: [PATCH] verify-oc: Ensure no output on error When the oc client is not connected to any cluster, it still outputs the version string, but also exits with an error. Instead of bailing out on the error, we ensure that the version string is empty before we assume that there is no 'oc' tool installed. --- cmd/verify/oc/cmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/verify/oc/cmd.go b/cmd/verify/oc/cmd.go index 033eb1b031..f2f8175f26 100644 --- a/cmd/verify/oc/cmd.go +++ b/cmd/verify/oc/cmd.go @@ -45,7 +45,7 @@ func run(_ *cobra.Command, _ []string) { ocDownloadURL := "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest" output, err := exec.Command("oc", "version").Output() - if err != nil { + if output == nil && err != nil { reporter.Errorf("OpenShift command-line tool is not installed.\n"+ "Go to %s to download the OpenShift client and add it to your PATH.", ocDownloadURL) return