mirror of
https://github.com/aquasecurity/kube-bench.git
synced 2024-12-20 21:58:06 +00:00
Refactor: remove ContinueWithError (#630)
* Update util.go Remove Continue with error function * Update cmd/util.go Co-authored-by: Liz Rice <liz@lizrice.com> * Update util.go * Update util.go Remove unnecessary ')' * Update util.go removed fmt.Fprintf(os.Stderr, "%s: %s", cmd.Args, err) since it wasn't suppose to print. * Update util.go * Update .travis.yml option --no-ri and --no-doc are deprecated we have to use --no-document instead. https://github.com/rubygems/heroku-buildpack-bundler2/pull/1#issuecomment-451654992 Co-authored-by: Liz Rice <liz@lizrice.com>
This commit is contained in:
parent
6684979741
commit
4b9453bb83
18
cmd/util.go
18
cmd/util.go
@ -48,18 +48,6 @@ func exitWithError(err error) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func continueWithError(err error, msg string) string {
|
||||
if err != nil {
|
||||
glog.V(2).Info(err)
|
||||
}
|
||||
|
||||
if msg != "" {
|
||||
fmt.Fprintf(os.Stderr, "%s\n", msg)
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func cleanIDs(list string) map[string]bool {
|
||||
list = strings.Trim(list, ",")
|
||||
ids := strings.Split(list, ",")
|
||||
@ -82,7 +70,7 @@ func ps(proc string) string {
|
||||
cmd := exec.Command("/bin/ps", "-C", proc, "-o", "cmd", "--no-headers")
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
continueWithError(fmt.Errorf("%s: %s", cmd.Args, err), "")
|
||||
glog.V(2).Info(fmt.Errorf("%s: %s", cmd.Args, err))
|
||||
}
|
||||
|
||||
glog.V(2).Info(fmt.Sprintf("ps - returning: %q", string(out)))
|
||||
@ -325,7 +313,7 @@ func getKubeVersionFromKubectl() string {
|
||||
cmd := exec.Command("kubectl", "version", "--short")
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
continueWithError(fmt.Errorf("%s", out), "")
|
||||
glog.V(2).Info(err)
|
||||
}
|
||||
|
||||
return getVersionFromKubectlOutput(string(out))
|
||||
@ -336,7 +324,7 @@ func getKubeVersionFromKubelet() string {
|
||||
out, err := cmd.CombinedOutput()
|
||||
|
||||
if err != nil {
|
||||
continueWithError(fmt.Errorf("%s", out), "")
|
||||
glog.V(2).Info(err)
|
||||
}
|
||||
|
||||
return getVersionFromKubeletOutput(string(out))
|
||||
|
Loading…
Reference in New Issue
Block a user