summaryrefslogtreecommitdiff
path: root/pkg/secrets/secrets.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2018-11-13 10:11:39 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2018-11-19 12:58:11 +0100
commit027d6ca6de3644414ee1f847d161184d027e4137 (patch)
tree10bf570de2c9b2449f562ff7d494157b31383ad8 /pkg/secrets/secrets.go
parenta0079d76572612e0f620cb4d3f481cef1e91e762 (diff)
downloadpodman-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/secrets/secrets.go')
-rw-r--r--pkg/secrets/secrets.go9
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)