mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Ensure parent dir exists for mount cleanup file
While investigating a test failure, I found this in the logs: ``` time="2019-07-04T15:06:32.622506760Z" level=warning msg="Error while setting daemon root propagation, this is not generally critical but may cause some functionality to not work or fallback to less desirable behavior" dir=/go/src/github.com/docker/docker/bundles/test-integration/d1285b8250308/root error="error writing file to signal mount cleanup on shutdown: open /tmp/dxr/d1285b8250308/unmount-on-shutdown: no such file or directory" ``` This path is generated from the daemon's exec-root, which appears to not exist yet. This change just makes sure it exists before we try to write a file. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
parent
2fc3480222
commit
7725b88edc
1 changed files with 4 additions and 0 deletions
|
@ -1287,6 +1287,10 @@ func setupDaemonRootPropagation(cfg *config.Config) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(filepath.Dir(cleanupFile), 0700); err != nil {
|
||||
return errors.Wrap(err, "error creating dir to store mount cleanup file")
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(cleanupFile, nil, 0600); err != nil {
|
||||
return errors.Wrap(err, "error writing file to signal mount cleanup on shutdown")
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue