From 6e5a304675648a9f3d9b0ae95e7610337c8bd6c3 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 9 Aug 2019 14:51:11 +0200 Subject: [PATCH] container.ConfigFilePath: use same signature on Windows This made my IDE unhappy; `ConfigFilePath` is an exported function, so it makes sense to use the same signature for both Linux and Windows. This patch also adds error handling (same as on Linux), even though the current implementation will never return an error (it's good practice to handle errors, so I assumed this would be the right approach) Signed-off-by: Sebastiaan van Stijn --- container/container_windows.go | 4 ++-- daemon/container_operations_windows.go | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/container/container_windows.go b/container/container_windows.go index 34b549fe91..11e255d82e 100644 --- a/container/container_windows.go +++ b/container/container_windows.go @@ -202,6 +202,6 @@ func (container *Container) ConfigsDirPath() string { } // ConfigFilePath returns the path to the on-disk location of a config. -func (container *Container) ConfigFilePath(configRef swarmtypes.ConfigReference) string { - return filepath.Join(container.ConfigsDirPath(), configRef.ConfigID) +func (container *Container) ConfigFilePath(configRef swarmtypes.ConfigReference) (string, error) { + return filepath.Join(container.ConfigsDirPath(), configRef.ConfigID), nil } diff --git a/daemon/container_operations_windows.go b/daemon/container_operations_windows.go index 6d84fe2dad..cc56bf4c79 100644 --- a/daemon/container_operations_windows.go +++ b/daemon/container_operations_windows.go @@ -55,7 +55,10 @@ func (daemon *Daemon) setupConfigDir(c *container.Container) (setupErr error) { continue } - fPath := c.ConfigFilePath(*configRef) + fPath, err := c.ConfigFilePath(*configRef) + if err != nil { + return errors.Wrap(err, "error getting config file path for container") + } log := logrus.WithFields(logrus.Fields{"name": configRef.File.Name, "path": fPath}) log.Debug("injecting config")