test
This commit is contained in:
@@ -1,38 +1,16 @@
|
||||
package helm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"errors"
|
||||
"os/exec"
|
||||
|
||||
log "oc-deploy/log_wrapper"
|
||||
)
|
||||
|
||||
type HelmCommandInterface interface {
|
||||
Status(string) (string, error)
|
||||
Status(string) (string, error)
|
||||
AddRepository(HelmRepo) (string, error)
|
||||
}
|
||||
|
||||
type HelmCommandData struct {
|
||||
bin string
|
||||
// name string
|
||||
Bin string
|
||||
}
|
||||
|
||||
type RealHelmCommandStatus HelmCommandData
|
||||
type RealHelmCommand HelmCommandData
|
||||
|
||||
func (this RealHelmCommandStatus) Status(name string) (string, error) {
|
||||
|
||||
msg := fmt.Sprintf("%s status %s --show-resources -o json", this.bin, name)
|
||||
log.Log().Debug().Msg(msg)
|
||||
|
||||
cmd_args := strings.Split(msg, " ")
|
||||
|
||||
cmd := exec.Command(cmd_args[0], cmd_args[1:]...)
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
log.Log().Debug().Msg(string(stdout))
|
||||
return "", errors.New(string(stdout))
|
||||
}
|
||||
|
||||
return string(stdout), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user