ingnore the NotExist error when removing inexistent files
| ... | ... |
@@ -278,7 +278,10 @@ func (d *Driver) Remove(id string) error {
|
| 278 | 278 |
if err := subvolDelete(d.subvolumesDir(), id); err != nil {
|
| 279 | 279 |
return err |
| 280 | 280 |
} |
| 281 |
- return os.RemoveAll(dir) |
|
| 281 |
+ if err := os.RemoveAll(dir); err != nil && !os.IsNotExist(err) {
|
|
| 282 |
+ return err |
|
| 283 |
+ } |
|
| 284 |
+ return nil |
|
| 282 | 285 |
} |
| 283 | 286 |
|
| 284 | 287 |
// Get the requested filesystem id. |
| ... | ... |
@@ -322,7 +322,10 @@ func (d *Driver) dir(id string) string {
|
| 322 | 322 |
|
| 323 | 323 |
// Remove cleans the directories that are created for this id. |
| 324 | 324 |
func (d *Driver) Remove(id string) error {
|
| 325 |
- return os.RemoveAll(d.dir(id)) |
|
| 325 |
+ if err := os.RemoveAll(d.dir(id)); err != nil && !os.IsNotExist(err) {
|
|
| 326 |
+ return err |
|
| 327 |
+ } |
|
| 328 |
+ return nil |
|
| 326 | 329 |
} |
| 327 | 330 |
|
| 328 | 331 |
// Get creates and mounts the required file system for the given id and returns the mount path. |
| ... | ... |
@@ -104,10 +104,10 @@ func (d *Driver) dir(id string) string {
|
| 104 | 104 |
|
| 105 | 105 |
// Remove deletes the content from the directory for a given id. |
| 106 | 106 |
func (d *Driver) Remove(id string) error {
|
| 107 |
- if _, err := os.Stat(d.dir(id)); err != nil {
|
|
| 107 |
+ if err := os.RemoveAll(d.dir(id)); err != nil && !os.IsNotExist(err) {
|
|
| 108 | 108 |
return err |
| 109 | 109 |
} |
| 110 |
- return os.RemoveAll(d.dir(id)) |
|
| 110 |
+ return nil |
|
| 111 | 111 |
} |
| 112 | 112 |
|
| 113 | 113 |
// Get returns the directory for the given id. |