1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Rename variable for consistency

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-08-09 15:01:40 +02:00
parent 6e5a304675
commit e128f17508
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -227,13 +227,13 @@ func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) {
} }
} }
for _, ref := range c.ConfigReferences { for _, configRef := range c.ConfigReferences {
// TODO (ehazlett): use type switch when more are supported // TODO (ehazlett): use type switch when more are supported
if ref.File == nil { if configRef.File == nil {
// Runtime configs are not mounted into the container, but they're // Runtime configs are not mounted into the container, but they're
// a valid type of config so we should not error when we encounter // a valid type of config so we should not error when we encounter
// one. // one.
if ref.Runtime == nil { if configRef.Runtime == nil {
logrus.Error("config target type is not a file or runtime target") logrus.Error("config target type is not a file or runtime target")
} }
// However, in any case, this isn't a file config, so we have no // However, in any case, this isn't a file config, so we have no
@ -241,7 +241,7 @@ func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) {
continue continue
} }
fPath, err := c.ConfigFilePath(*ref) fPath, err := c.ConfigFilePath(*configRef)
if err != nil { if err != nil {
return errors.Wrap(err, "error getting config file path for container") return errors.Wrap(err, "error getting config file path for container")
} }
@ -250,22 +250,22 @@ func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) {
} }
logrus.WithFields(logrus.Fields{ logrus.WithFields(logrus.Fields{
"name": ref.File.Name, "name": configRef.File.Name,
"path": fPath, "path": fPath,
}).Debug("injecting config") }).Debug("injecting config")
config, err := c.DependencyStore.Configs().Get(ref.ConfigID) config, err := c.DependencyStore.Configs().Get(configRef.ConfigID)
if err != nil { if err != nil {
return errors.Wrap(err, "unable to get config from config store") return errors.Wrap(err, "unable to get config from config store")
} }
if err := ioutil.WriteFile(fPath, config.Spec.Data, ref.File.Mode); err != nil { if err := ioutil.WriteFile(fPath, config.Spec.Data, configRef.File.Mode); err != nil {
return errors.Wrap(err, "error injecting config") return errors.Wrap(err, "error injecting config")
} }
uid, err := strconv.Atoi(ref.File.UID) uid, err := strconv.Atoi(configRef.File.UID)
if err != nil { if err != nil {
return err return err
} }
gid, err := strconv.Atoi(ref.File.GID) gid, err := strconv.Atoi(configRef.File.GID)
if err != nil { if err != nil {
return err return err
} }
@ -273,7 +273,7 @@ func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) {
if err := os.Chown(fPath, rootIDs.UID+uid, rootIDs.GID+gid); err != nil { if err := os.Chown(fPath, rootIDs.UID+uid, rootIDs.GID+gid); err != nil {
return errors.Wrap(err, "error setting ownership for config") return errors.Wrap(err, "error setting ownership for config")
} }
if err := os.Chmod(fPath, ref.File.Mode); err != nil { if err := os.Chmod(fPath, configRef.File.Mode); err != nil {
return errors.Wrap(err, "error setting file mode for config") return errors.Wrap(err, "error setting file mode for config")
} }
} }