format Unix

This commit is contained in:
admju
2024-09-02 11:44:44 +00:00
parent 11f56722f7
commit 9cf954776f
24 changed files with 1097 additions and 1097 deletions

View File

@@ -1,53 +1,53 @@
package helm
import (
"fmt"
"strings"
"os/exec"
log "oc-deploy/log_wrapper"
)
type HelmRepo struct {
Bin string // Chemin vers le binaire
Name string
Repository string // Url du dépôt
ForceUpdate bool
Opts string
}
func (this HelmRepo) AddRepository() (string, error) {
helm_bin := this.Bin
force_update := "--force-update=false"
if this.ForceUpdate {
force_update = "--force-update=true"
}
msg := fmt.Sprintf("%s repo add %s %s %s %s", helm_bin, this.Name, this.Repository, force_update, this.Opts)
log.Log().Debug().Msg(msg)
cmd := exec.Command(helm_bin, "repo", "add", this.Name, this.Repository, force_update)
stdout, err := cmd.CombinedOutput()
res := string(stdout)
res = strings.TrimSuffix(res, "\n")
return res, err
}
// helm repo remove [NAME]
func (this HelmRepo) RemoveRepository() (string, error) {
helm_bin := this.Bin
msg := fmt.Sprintf("%s repo remove %s", helm_bin, this.Name)
log.Log().Debug().Msg(msg)
cmd := exec.Command(helm_bin, "repo", "remove", this.Name)
stdout, err := cmd.CombinedOutput()
res := string(stdout)
res = strings.TrimSuffix(res, "\n")
return res, err
}
package helm
import (
"fmt"
"strings"
"os/exec"
log "oc-deploy/log_wrapper"
)
type HelmRepo struct {
Bin string // Chemin vers le binaire
Name string
Repository string // Url du dépôt
ForceUpdate bool
Opts string
}
func (this HelmRepo) AddRepository() (string, error) {
helm_bin := this.Bin
force_update := "--force-update=false"
if this.ForceUpdate {
force_update = "--force-update=true"
}
msg := fmt.Sprintf("%s repo add %s %s %s %s", helm_bin, this.Name, this.Repository, force_update, this.Opts)
log.Log().Debug().Msg(msg)
cmd := exec.Command(helm_bin, "repo", "add", this.Name, this.Repository, force_update)
stdout, err := cmd.CombinedOutput()
res := string(stdout)
res = strings.TrimSuffix(res, "\n")
return res, err
}
// helm repo remove [NAME]
func (this HelmRepo) RemoveRepository() (string, error) {
helm_bin := this.Bin
msg := fmt.Sprintf("%s repo remove %s", helm_bin, this.Name)
log.Log().Debug().Msg(msg)
cmd := exec.Command(helm_bin, "repo", "remove", this.Name)
stdout, err := cmd.CombinedOutput()
res := string(stdout)
res = strings.TrimSuffix(res, "\n")
return res, err
}