From d41a16445c3e7af3de2a959e61f899743d5ea65d Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Thu, 12 Oct 2017 17:08:54 +0200 Subject: [PATCH] follow up for secrets patch Signed-off-by: Antonio Murdaca --- libkpod/config.go | 2 -- server/container_create.go | 9 +++++---- server/secrets.go | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libkpod/config.go b/libkpod/config.go index 1fd86a3b..d97f2a43 100644 --- a/libkpod/config.go +++ b/libkpod/config.go @@ -26,8 +26,6 @@ const ( containerExitsDir = oci.ContainerExitsDir // DefaultMountsFile holds the default mount paths in the form "host:container" DefaultMountsFile = "/usr/share/containers/mounts.conf" - // OverrideMountsFile holds the override mount paths in the form "host:container" - OverrideMountsFile = "/etc/containers/mounts.conf" ) // Config represents the entire set of configuration values that can be set for diff --git a/server/container_create.go b/server/container_create.go index 1e036554..ba118604 100644 --- a/server/container_create.go +++ b/server/container_create.go @@ -386,8 +386,7 @@ func ensureSaneLogPath(logPath string) error { // addSecretsBindMounts mounts user defined secrets to the container func addSecretsBindMounts(mountLabel, ctrRunDir, configDefaultMountsPath string, specgen generate.Generator) error { - mountPaths := []string{libkpod.OverrideMountsFile, libkpod.DefaultMountsFile} - // configDefaultMountsPath is used to override the mount file path for testing purposes only when set in the runtime config + mountPaths := []string{libkpod.DefaultMountsFile} if configDefaultMountsPath != "" { mountPaths = []string{configDefaultMountsPath} } @@ -932,8 +931,10 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string, return nil, err } - if err = addSecretsBindMounts(mountLabel, containerInfo.RunDir, s.config.DefaultMountsPath, specgen); err != nil { - return nil, fmt.Errorf("failed to mount secrets: %v", err) + if s.config.DefaultMountsPath != "" { + if err = addSecretsBindMounts(mountLabel, containerInfo.RunDir, s.config.DefaultMountsPath, specgen); err != nil { + return nil, fmt.Errorf("failed to mount secrets: %v", err) + } } mountPoint, err := s.StorageRuntimeServer().StartContainer(containerID) diff --git a/server/secrets.go b/server/secrets.go index 34236c1f..f7096065 100644 --- a/server/secrets.go +++ b/server/secrets.go @@ -34,7 +34,7 @@ func readMountFile(mountFilePath string) ([]string, error) { var mountPaths []string file, err := os.Open(mountFilePath) if err != nil { - logrus.Warnf("file doesn't exist %q", mountFilePath) + logrus.Debugf("file doesn't exist %q, skipping...", mountFilePath) return nil, nil } defer file.Close()