mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 11:48:04 +00:00
* Refactorings * save * REdesigning install dialog * Display values editor * Reconfigure flow * Status handler and version * error reporting
34 lines
633 B
Go
34 lines
633 B
Go
package dashboard
|
|
|
|
import (
|
|
"errors"
|
|
"io/ioutil"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
type ControlChan = chan struct{}
|
|
|
|
func chartAndVersion(x string) (string, string, error) {
|
|
lastInd := strings.LastIndex(x, "-")
|
|
if lastInd < 0 {
|
|
return "", "", errors.New("can't parse chart version string")
|
|
}
|
|
|
|
return x[:lastInd], x[lastInd+1:], nil
|
|
}
|
|
|
|
func tempFile(txt string) (string, func(), error) {
|
|
file, err := ioutil.TempFile("", "helm_vals_")
|
|
if err != nil {
|
|
return "", nil, err
|
|
}
|
|
|
|
err = ioutil.WriteFile(file.Name(), []byte(txt), 0600)
|
|
if err != nil {
|
|
return "", nil, err
|
|
}
|
|
|
|
return file.Name(), func() { os.Remove(file.Name()) }, nil
|
|
}
|