summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2018-07-17 16:48:08 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2018-07-20 11:00:53 +0200
commit45a92f8357de75d06c137e48ce61ab8054d5bc8e (patch)
tree1db0e9964c985a32e79f51e9fc1e02bbdabd5e27
parentc737d01937fc3644bdabbe50df71a455aa3b1f8b (diff)
downloadpodman-45a92f8357de75d06c137e48ce61ab8054d5bc8e.tar.gz
podman-45a92f8357de75d06c137e48ce61ab8054d5bc8e.tar.bz2
podman-45a92f8357de75d06c137e48ce61ab8054d5bc8e.zip
secrets: parse only one mounts configuration file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
-rw-r--r--pkg/secrets/secrets.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/pkg/secrets/secrets.go b/pkg/secrets/secrets.go
index ba0f3b925..f245b9512 100644
--- a/pkg/secrets/secrets.go
+++ b/pkg/secrets/secrets.go
@@ -147,11 +147,14 @@ func SecretMountsWithUIDGID(mountLabel, containerWorkingDir, mountFile, mountPre
mountFiles = append(mountFiles, mountFile)
}
for _, file := range mountFiles {
- mounts, err := addSecretsFromMountsFile(file, mountLabel, containerWorkingDir, mountPrefix, uid, gid)
- if err != nil {
- logrus.Warnf("error mounting secrets, skipping: %v", err)
+ if _, err := os.Stat(file); err == nil {
+ mounts, err := addSecretsFromMountsFile(file, mountLabel, containerWorkingDir, mountPrefix, uid, gid)
+ if err != nil {
+ logrus.Warnf("error mounting secrets, skipping: %v", err)
+ }
+ secretMounts = mounts
+ break
}
- secretMounts = append(secretMounts, mounts...)
}
// Add FIPS mode secret if /etc/system-fips exists on the host