Fix archiveOnDelete parsing
This commit is contained in:
		
							parent
							
								
									f46a12bccb
								
							
						
					
					
						commit
						9b94fa6ac2
					
				|  | @ -113,13 +113,15 @@ 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"] | ||||||
|  | 	if exists { | ||||||
| 		archiveBool, err := strconv.ParseBool(archiveOnDelete) | 		archiveBool, err := strconv.ParseBool(archiveOnDelete) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
| 	if exists && !archiveBool { | 		if !archiveBool { | ||||||
| 			return os.RemoveAll(oldPath) | 			return os.RemoveAll(oldPath) | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	archivePath := filepath.Join(mountPath, "archived-"+pvName) | 	archivePath := filepath.Join(mountPath, "archived-"+pvName) | ||||||
| 	glog.V(4).Infof("archiving path %s to %s", oldPath, archivePath) | 	glog.V(4).Infof("archiving path %s to %s", oldPath, archivePath) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue