summaryrefslogtreecommitdiff
path: root/libpod/runtime.go
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2018-12-03 11:07:01 -0500
committerMatthew Heon <mheon@redhat.com>2018-12-03 11:10:02 -0500
commit677c44446375680c5a69a9612f7df42b25de783f (patch)
treebb5e0dcf5d4b974417a676d9d50fea0aaa083043 /libpod/runtime.go
parentea13264958f3382fe8fe6a9709a7eae00f753acc (diff)
downloadpodman-677c44446375680c5a69a9612f7df42b25de783f.tar.gz
podman-677c44446375680c5a69a9612f7df42b25de783f.tar.bz2
podman-677c44446375680c5a69a9612f7df42b25de783f.zip
Ensure directory where we will make database exists
Ensure that the directory where we will create the Podman db exists prior to creating the database - otherwise creating the DB will fail. Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r--libpod/runtime.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 9afa1bc10..8b5bc32b4 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -472,6 +472,15 @@ func makeRuntime(runtime *Runtime) (err error) {
runtime.config.ConmonPath)
}
+ // Make the static files directory if it does not exist
+ if err := os.MkdirAll(runtime.config.StaticDir, 0700); err != nil {
+ // The directory is allowed to exist
+ if !os.IsExist(err) {
+ return errors.Wrapf(err, "error creating runtime static files directory %s",
+ runtime.config.StaticDir)
+ }
+ }
+
// Set up the state
switch runtime.config.StateType {
case InMemoryStateStore:
@@ -601,15 +610,6 @@ func makeRuntime(runtime *Runtime) (err error) {
}
runtime.ociRuntime = ociRuntime
- // Make the static files directory if it does not exist
- if err := os.MkdirAll(runtime.config.StaticDir, 0755); err != nil {
- // The directory is allowed to exist
- if !os.IsExist(err) {
- return errors.Wrapf(err, "error creating runtime static files directory %s",
- runtime.config.StaticDir)
- }
- }
-
// Make a directory to hold container lockfiles
lockDir := filepath.Join(runtime.config.TmpDir, "lock")
if err := os.MkdirAll(lockDir, 0755); err != nil {