diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2018-11-13 10:11:39 +0100 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2018-11-19 12:58:11 +0100 |
commit | 027d6ca6de3644414ee1f847d161184d027e4137 (patch) | |
tree | 10bf570de2c9b2449f562ff7d494157b31383ad8 /pkg | |
parent | a0079d76572612e0f620cb4d3f481cef1e91e762 (diff) | |
download | podman-027d6ca6de3644414ee1f847d161184d027e4137.tar.gz podman-027d6ca6de3644414ee1f847d161184d027e4137.tar.bz2 podman-027d6ca6de3644414ee1f847d161184d027e4137.zip |
rootless: create empty mounts.conf if it doesn't exist
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/secrets/secrets.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/secrets/secrets.go b/pkg/secrets/secrets.go index 7208f53b7..242953609 100644 --- a/pkg/secrets/secrets.go +++ b/pkg/secrets/secrets.go @@ -149,6 +149,15 @@ func SecretMountsWithUIDGID(mountLabel, containerWorkingDir, mountFile, mountPre mountFiles = append(mountFiles, []string{OverrideMountsFile, DefaultMountsFile}...) if rootless.IsRootless() { mountFiles = append([]string{UserOverrideMountsFile}, mountFiles...) + _, err := os.Stat(UserOverrideMountsFile) + if err != nil && os.IsNotExist(err) { + os.MkdirAll(filepath.Dir(UserOverrideMountsFile), 0755) + if f, err := os.Create(UserOverrideMountsFile); err != nil { + logrus.Warnf("could not create file %s: %v", UserOverrideMountsFile, err) + } else { + f.Close() + } + } } } else { mountFiles = append(mountFiles, mountFile) |