mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-05 14:00:05 +02:00
fix: use temporary file for secret file to prevent deletion collision (#250)
Fixes #167
This commit is contained in:
committed by
KUOKA Yusuke
parent
822cc13e72
commit
9b71c64ef2
+15
-1
@@ -2,6 +2,8 @@ package helmexec
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/zap"
|
||||
@@ -102,7 +104,19 @@ func (helm *execer) DecryptSecret(name string) (string, error) {
|
||||
helm.logger.Infof("Decrypting secret %v", name)
|
||||
out, err := helm.exec(append([]string{"secrets", "dec", name})...)
|
||||
helm.write(out)
|
||||
return name + ".dec", err
|
||||
|
||||
tmpFile, err := ioutil.TempFile("", "secret")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
tmpFile.Close()
|
||||
|
||||
err = os.Rename(name+".dec", tmpFile.Name())
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return tmpFile.Name(), err
|
||||
}
|
||||
|
||||
func (helm *execer) DiffRelease(name, chart string, flags ...string) error {
|
||||
|
||||
Reference in New Issue
Block a user