Skip to content

Commit

Permalink
fix: avoid "cross-device link" errors while decrypting secrets (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
mumoshu authored Aug 30, 2018
1 parent 0c8a89c commit 79f0e70
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions helmexec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,18 @@ func (helm *execer) DecryptSecret(name string) (string, error) {
if err != nil {
return "", err
}
tmpFile.Close()
defer tmpFile.Close()

err = os.Rename(name+".dec", tmpFile.Name())
// os.Rename seems to results in "cross-device link` errors in some cases
// Instead of moving, copy it to the destination temp file as a work-around
// See https://github.com/roboll/helmfile/issues/251#issuecomment-417166296
decFile, err := os.Open(name + ".dec")
if err != nil {
return "", err
}
defer decFile.Close()

_, err = io.Copy(tmpFile, decFile)
if err != nil {
return "", err
}
Expand Down

0 comments on commit 79f0e70

Please sign in to comment.