oc-deploy/src/helm/status.go

33 lines
666 B
Go
Raw Normal View History

2024-09-09 09:38:43 +02:00
package helm
import (
"fmt"
"strings"
2024-09-09 16:17:02 +02:00
"errors"
2024-09-09 09:38:43 +02:00
log "oc-deploy/log_wrapper"
)
2024-09-09 16:17:02 +02:00
// type HelmData struct {
// Name string
// }
func (this HelmCommand) Status(data HelmChart) (string, error) {
2024-09-09 09:38:43 +02:00
helm_bin := this.Bin
2024-09-09 16:17:02 +02:00
msg := fmt.Sprintf("%s status %s --show-resources -o json", helm_bin, data.Name)
2024-09-09 09:38:43 +02:00
log.Log().Debug().Msg(msg)
cmd_args := strings.Split(msg, " ")
2024-09-09 16:17:02 +02:00
cmd := this.Exec(cmd_args[0], cmd_args[1:]...)
2024-09-09 09:38:43 +02:00
stdout, err := cmd.CombinedOutput()
if err != nil {
log.Log().Debug().Msg(string(stdout))
return "", errors.New(string(stdout))
}
return string(stdout), nil
}