mirror of
https://github.com/Mic92/sops-nix.git
synced 2026-05-12 10:55:56 +08:00
fix changing between a secret file and a directory with the same name
This commit is contained in:
parent
10957db2de
commit
ad2ae68ffc
1 changed files with 4 additions and 4 deletions
|
|
@ -966,8 +966,8 @@ func handleModifications(isDry bool, logcfg loggingConfig, symlinkPath string, s
|
||||||
// Read the old file
|
// Read the old file
|
||||||
oldData, err := os.ReadFile(oldPath)
|
oldData, err := os.ReadFile(oldPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
// File did not exist before or the path changed from a file to a directory or vice versa
|
||||||
// File did not exist before
|
if os.IsNotExist(err) || errors.Is(err, syscall.ENOTDIR) || errors.Is(err, syscall.EISDIR) {
|
||||||
restart = append(restart, secret.RestartUnits...)
|
restart = append(restart, secret.RestartUnits...)
|
||||||
reload = append(reload, secret.ReloadUnits...)
|
reload = append(reload, secret.ReloadUnits...)
|
||||||
newSecrets[secret.Name] = true
|
newSecrets[secret.Name] = true
|
||||||
|
|
@ -997,8 +997,8 @@ func handleModifications(isDry bool, logcfg loggingConfig, symlinkPath string, s
|
||||||
// Read the old file
|
// Read the old file
|
||||||
oldData, err := os.ReadFile(oldPath)
|
oldData, err := os.ReadFile(oldPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
// File did not exist before or the path changed from a file to a directory or vice versa
|
||||||
// File did not exist before
|
if os.IsNotExist(err) || errors.Is(err, syscall.ENOTDIR) || errors.Is(err, syscall.EISDIR) {
|
||||||
restart = append(restart, template.RestartUnits...)
|
restart = append(restart, template.RestartUnits...)
|
||||||
reload = append(reload, template.ReloadUnits...)
|
reload = append(reload, template.ReloadUnits...)
|
||||||
newTemplates[template.Name] = true
|
newTemplates[template.Name] = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue