Skip to content
Snippets Groups Projects
Commit f589fd58 authored by Abubakr-Sadik Nii Nai Davis's avatar Abubakr-Sadik Nii Nai Davis
Browse files

Add few modifications.

parent 3d395994
Branches
Tags
No related merge requests found
......@@ -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,
),
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment