registry: remove unused error return from HostCertsDir()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-02-26 13:40:46 +01:00
parent 6e3e657ea6
commit 273dca4e3c
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 6 additions and 16 deletions

View File

@ -183,11 +183,9 @@ func (daemon *Daemon) RegistryHosts() docker.RegistryHosts {
} }
for k, v := range m { for k, v := range m {
if d, err := registry.HostCertsDir(k); err == nil { v.TLSConfigDir = []string{registry.HostCertsDir(k)}
v.TLSConfigDir = []string{d}
m[k] = v m[k] = v
} }
}
certsDir := registry.CertsDir() certsDir := registry.CertsDir()
if fis, err := os.ReadDir(certsDir); err == nil { if fis, err := os.ReadDir(certsDir); err == nil {

View File

@ -16,13 +16,9 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
// HostCertsDir returns the config directory for a specific host // HostCertsDir returns the config directory for a specific host.
func HostCertsDir(hostname string) (string, error) { func HostCertsDir(hostname string) string {
certsDir := CertsDir() return filepath.Join(CertsDir(), cleanPath(hostname))
hostDir := filepath.Join(certsDir, cleanPath(hostname))
return hostDir, nil
} }
func newTLSConfig(hostname string, isSecure bool) (*tls.Config, error) { func newTLSConfig(hostname string, isSecure bool) (*tls.Config, error) {
@ -32,11 +28,7 @@ func newTLSConfig(hostname string, isSecure bool) (*tls.Config, error) {
tlsConfig.InsecureSkipVerify = !isSecure tlsConfig.InsecureSkipVerify = !isSecure
if isSecure && CertsDir() != "" { if isSecure && CertsDir() != "" {
hostDir, err := HostCertsDir(hostname) hostDir := HostCertsDir(hostname)
if err != nil {
return nil, err
}
logrus.Debugf("hostDir: %s", hostDir) logrus.Debugf("hostDir: %s", hostDir)
if err := ReadCertsDirectory(tlsConfig, hostDir); err != nil { if err := ReadCertsDirectory(tlsConfig, hostDir); err != nil {
return nil, err return nil, err