`os.RemoveAll()` should never return this error. From the docs:
> If the path does not exist, RemoveAll returns nil (no error).
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -331,7 +331,7 @@ func (daemon *Daemon) cleanupSecretDir(c *container.Container) {
|
| 331 | 331 |
if err := mount.RecursiveUnmount(dir); err != nil {
|
| 332 | 332 |
logrus.WithField("dir", dir).WithError(err).Warn("Error while attempting to unmount dir, this may prevent removal of container.")
|
| 333 | 333 |
} |
| 334 |
- if err := os.RemoveAll(dir); err != nil && !os.IsNotExist(err) {
|
|
| 334 |
+ if err := os.RemoveAll(dir); err != nil {
|
|
| 335 | 335 |
logrus.WithField("dir", dir).WithError(err).Error("Error removing dir.")
|
| 336 | 336 |
} |
| 337 | 337 |
} |
| ... | ... |
@@ -144,7 +144,7 @@ func (pm *Manager) HandleExitEvent(id string) error {
|
| 144 | 144 |
return err |
| 145 | 145 |
} |
| 146 | 146 |
|
| 147 |
- if err := os.RemoveAll(filepath.Join(pm.config.ExecRoot, id)); err != nil && !os.IsNotExist(err) {
|
|
| 147 |
+ if err := os.RemoveAll(filepath.Join(pm.config.ExecRoot, id)); err != nil {
|
|
| 148 | 148 |
logrus.WithError(err).WithField("id", id).Error("Could not remove plugin bundle dir")
|
| 149 | 149 |
} |
| 150 | 150 |
|
| ... | ... |
@@ -239,7 +239,7 @@ func (pm *Manager) upgradePlugin(p *v2.Plugin, configDigest, manifestDigest dige |
| 239 | 239 |
|
| 240 | 240 |
defer func() {
|
| 241 | 241 |
if err != nil {
|
| 242 |
- if rmErr := os.RemoveAll(orig); rmErr != nil && !os.IsNotExist(rmErr) {
|
|
| 242 |
+ if rmErr := os.RemoveAll(orig); rmErr != nil {
|
|
| 243 | 243 |
logrus.WithError(rmErr).WithField("dir", backup).Error("error cleaning up after failed upgrade")
|
| 244 | 244 |
return |
| 245 | 245 |
} |
| ... | ... |
@@ -250,7 +250,7 @@ func (pm *Manager) upgradePlugin(p *v2.Plugin, configDigest, manifestDigest dige |
| 250 | 250 |
logrus.WithError(rmErr).WithField("plugin", p.Name()).Errorf("error cleaning up plugin upgrade dir: %s", tmpRootFSDir)
|
| 251 | 251 |
} |
| 252 | 252 |
} else {
|
| 253 |
- if rmErr := os.RemoveAll(backup); rmErr != nil && !os.IsNotExist(rmErr) {
|
|
| 253 |
+ if rmErr := os.RemoveAll(backup); rmErr != nil {
|
|
| 254 | 254 |
logrus.WithError(rmErr).WithField("dir", backup).Error("error cleaning up old plugin root after successful upgrade")
|
| 255 | 255 |
} |
| 256 | 256 |
|