follow up for secrets patch

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-10-12 17:08:54 +02:00
parent d5b5028cb9
commit d41a16445c
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
3 changed files with 6 additions and 7 deletions

View file

@ -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

View file

@ -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)

View file

@ -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()