mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-03 11:45:20 +00:00
Merge pull request #7072 from ywk253100/231108_truncate
[cherry-pick]Truncate the credential file to avoid the change of secret content messing it up
This commit is contained in:
1
changelogs/unreleased/7072-ywk253100
Normal file
1
changelogs/unreleased/7072-ywk253100
Normal file
@@ -0,0 +1 @@
|
||||
Truncate the credential file to avoid the change of secret content messing it up
|
||||
@@ -71,7 +71,7 @@ func (n *namespacedFileStore) Path(selector *corev1api.SecretKeySelector) (strin
|
||||
|
||||
keyFilePath := filepath.Join(n.fsRoot, fmt.Sprintf("%s-%s", selector.Name, selector.Key))
|
||||
|
||||
file, err := n.fs.OpenFile(keyFilePath, os.O_RDWR|os.O_CREATE, 0644)
|
||||
file, err := n.fs.OpenFile(keyFilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "unable to open credentials file for writing")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user