diff --git a/check/check.go b/check/check.go index f005e37ff0f9480394ebf9828eda68c0eee244a8..e73c58f4675e0821030bdadcadb3bdb1ded7c765 100644 --- a/check/check.go +++ b/check/check.go @@ -106,7 +106,7 @@ func (c *Check) Run(verbose bool) { cs[i-1].Stdout, err = cs[i].StdinPipe() errmsgs += handleError( err, - fmt.Sprintf("check.Run: Audit %s failed\nfailing command: %s", + fmt.Sprintf("failed to run: %s\nfailed command: %s", c.Audit, cs[i].Args, ), @@ -121,7 +121,7 @@ func (c *Check) Run(verbose bool) { err := cs[i].Start() errmsgs += handleError( err, - fmt.Sprintf("check.Run: Audit %s failed\nfailing command: %s", + fmt.Sprintf("failed to run: %s\nfailed command: %s", c.Audit, cs[i].Args, ), @@ -135,7 +135,7 @@ func (c *Check) Run(verbose bool) { err := cs[i].Wait() errmsgs += handleError( err, - fmt.Sprintf("check.Run: Audit %s failed\nfailing command: %s", + fmt.Sprintf("failed to run: %s\nfailed command:%s", c.Audit, cs[i].Args, ), diff --git a/cmd/util.go b/cmd/util.go index 5a01e0dc7b35149951da39dd88783ca7550a27fa..6a1f790bff214db46c15c2ac33bb2afe0f71ff86 100644 --- a/cmd/util.go +++ b/cmd/util.go @@ -56,7 +56,13 @@ func verifyBin(binPath ...string) []string { // Construct proc name for ps(1) for _, b := range binPath { binList += b + "," + _, err := exec.LookPath(b) + errmsgs += handleError( + err, + fmt.Sprintf("%s: command not found in path", b), + ) } + binList = strings.Trim(binList, ",") // Run ps command @@ -64,7 +70,7 @@ func verifyBin(binPath ...string) []string { out, err := cmd.Output() errmsgs += handleError( err, - fmt.Sprintf("verifyBin: %s failed", binList), + fmt.Sprintf("failed to run: %s", cmd.Args), ) // Actual verification @@ -84,12 +90,18 @@ func verifyKubeVersion(b string) []string { // TODO! Check the version number using kubectl, which is more likely to be on the path. var w []string + _, err := exec.LookPath(b) + errmsgs += handleError( + err, + fmt.Sprintf("%s: command not found on path - version check skipped", b), + ) + // Check version cmd := exec.Command(b, "--version") out, err := cmd.Output() errmsgs += handleError( err, - fmt.Sprintf("verifyKubeVersion: failed\nCommand:%s", cmd.Args), + fmt.Sprintf("failed to run:%s", cmd.Args), ) matched := strings.Contains(string(out), kubeVersion)