Skip to content

Commit

Permalink
fix: update shell error handling (#27)
Browse files Browse the repository at this point in the history
Signed-off-by: chenk <[email protected]>

Signed-off-by: chenk <[email protected]>
  • Loading branch information
chen-keinan authored Jan 13, 2023
1 parent 434ddc4 commit 813bed1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/collector/shell.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package collector

import (
"fmt"
"os/exec"
"strings"
)
Expand Down Expand Up @@ -40,7 +39,6 @@ func (e *cmd) Execute(commandArgs string) (string, error) {
cm := exec.Command(shellCommand, "-c", commandArgs)
output, err := cm.CombinedOutput()
if err != nil {
fmt.Println(fmt.Sprint(err) + ": " + string(output))
return "", nil
}
// trim newline
Expand All @@ -57,7 +55,7 @@ func (e *cmd) FindNodeType() (string, error) {
for _, path := range masterConfigFiles {
output, err := e.Execute(path)
if err != nil {
return "", err
return WorkerNode, nil
}
outputParts := strings.Split(output, ",")
if len(outputParts) > 0 {
Expand Down

0 comments on commit 813bed1

Please sign in to comment.