mirror of https://github.com/containers/podman.git
Merge pull request #11523 from Luap99/e2e-warning
try to create the runroot before we warn that it is not writable
This commit is contained in:
commit
580ac4c6ab
|
@ -335,8 +335,16 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
|
|||
// If user is rootless and XDG_RUNTIME_DIR is found, podman will not proceed with /tmp directory
|
||||
// it will try to use existing XDG_RUNTIME_DIR
|
||||
// if current user has no write access to XDG_RUNTIME_DIR we will fail later
|
||||
if unix.Access(runtime.storageConfig.RunRoot, unix.W_OK) != nil {
|
||||
logrus.Warnf("XDG_RUNTIME_DIR is pointing to a path which is not writable. Most likely podman will fail.")
|
||||
if err := unix.Access(runtime.storageConfig.RunRoot, unix.W_OK); err != nil {
|
||||
msg := "XDG_RUNTIME_DIR is pointing to a path which is not writable. Most likely podman will fail."
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
// if dir does not exists try to create it
|
||||
if err := os.MkdirAll(runtime.storageConfig.RunRoot, 0700); err != nil {
|
||||
logrus.Warn(msg)
|
||||
}
|
||||
} else {
|
||||
logrus.Warn(msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue