Skip to content

Commit

Permalink
verify-oc: Ensure no output on error
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vkareh committed Aug 27, 2020
1 parent 2fecd66 commit 6a67ba9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/verify/oc/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6a67ba9

Please sign in to comment.