Commit a54ff504 by Matthew Wong Committed by kmova

Fix archiveOnDelete parsing

(cherry picked from commit 9b94fa6ac252e8e43f5a2d77b597b7013253a121)
parent 7c1944a9
...@@ -113,12 +113,14 @@ func (p *nfsProvisioner) Delete(volume *v1.PersistentVolume) error { ...@@ -113,12 +113,14 @@ func (p *nfsProvisioner) Delete(volume *v1.PersistentVolume) error {
// If it exists and has a falsey value, delete the directory. // If it exists and has a falsey value, delete the directory.
// Otherwise, archive it. // Otherwise, archive it.
archiveOnDelete, exists := storageClass.Parameters["archiveOnDelete"] archiveOnDelete, exists := storageClass.Parameters["archiveOnDelete"]
archiveBool, err := strconv.ParseBool(archiveOnDelete) if exists {
if err != nil { archiveBool, err := strconv.ParseBool(archiveOnDelete)
return err if err != nil {
} return err
if exists && !archiveBool { }
return os.RemoveAll(oldPath) if !archiveBool {
return os.RemoveAll(oldPath)
}
} }
archivePath := filepath.Join(mountPath, "archived-"+pvName) archivePath := filepath.Join(mountPath, "archived-"+pvName)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment