diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2018-11-19 08:44:57 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-19 08:44:57 -0800 |
commit | 64a29e383bb1c12b94a3f6f6be4538f9758d7fb9 (patch) | |
tree | f840ae31f0cb6c7d9ea6579e0b778fe58dd609b2 /pkg/secrets/secrets.go | |
parent | 4eecc8cf70728d733aa8d1c948093d9ae4a334df (diff) | |
parent | 027d6ca6de3644414ee1f847d161184d027e4137 (diff) | |
download | podman-64a29e383bb1c12b94a3f6f6be4538f9758d7fb9.tar.gz podman-64a29e383bb1c12b94a3f6f6be4538f9758d7fb9.tar.bz2 podman-64a29e383bb1c12b94a3f6f6be4538f9758d7fb9.zip |
Merge pull request #1806 from giuseppe/rootless-create-default-files
rootless: create user conf files when they don't exist
Diffstat (limited to 'pkg/secrets/secrets.go')
-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) |