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

View File

@@ -2,6 +2,7 @@ package helm
import (
"fmt"
"strconv"
"os"
"os/exec"
"strings"
@@ -41,7 +42,6 @@ func (this HelmChart) Install() (string, error) {
if err != nil {
return "", err
}
// existe := false
if existe {
return "Existe déjà", nil
@@ -137,6 +137,7 @@ func (this HelmChart) exists() (bool, error) {
cmd := exec.Command(cmd_args[0], cmd_args[1:]...)
stdout, err := cmd.CombinedOutput()
if err != nil {
log.Log().Debug().Msg(string(stdout))
return false, errors.New(string(stdout))
}
@@ -144,6 +145,15 @@ func (this HelmChart) exists() (bool, error) {
res = strings.TrimSuffix(res, "\n")
log.Log().Debug().Msg(string(stdout))
log.Log().Debug().Msg(strconv.FormatBool(res != ""))
return res != "", nil
}
func (this HelmChart) GetRessources() (map[string]string, error) {
hs := HelmStatus{Name: this.Name}
hs.New(this.Bin)
data, _ := hs.getRessources()
return data, nil
}