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 <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-08-09 14:51:11 +02:00
parent 1a117b8b5c
commit 6e5a304675
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 6 additions and 3 deletions

View File

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

View File

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