Ressources

This commit is contained in:
admju
2024-09-06 14:08:05 +00:00
parent 052e6f1368
commit da9aab90eb
8 changed files with 907 additions and 8 deletions

38
src/helm/command.go Normal file
View File

@@ -0,0 +1,38 @@
package helm
import (
"fmt"
"strings"
"errors"
"os/exec"
log "oc-deploy/log_wrapper"
)
type HelmCommandInterface interface {
Status(string) (string, error)
}
type HelmCommandData struct {
bin string
// name string
}
type RealHelmCommandStatus 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
}