Browse code

Rename variable for consistency

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/08/09 22:01:40
Showing 1 changed files
... ...
@@ -227,13 +227,13 @@ func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) {
227 227
 		}
228 228
 	}
229 229
 
230
-	for _, ref := range c.ConfigReferences {
230
+	for _, configRef := range c.ConfigReferences {
231 231
 		// TODO (ehazlett): use type switch when more are supported
232
-		if ref.File == nil {
232
+		if configRef.File == nil {
233 233
 			// Runtime configs are not mounted into the container, but they're
234 234
 			// a valid type of config so we should not error when we encounter
235 235
 			// one.
236
-			if ref.Runtime == nil {
236
+			if configRef.Runtime == nil {
237 237
 				logrus.Error("config target type is not a file or runtime target")
238 238
 			}
239 239
 			// 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) {
241 241
 			continue
242 242
 		}
243 243
 
244
-		fPath, err := c.ConfigFilePath(*ref)
244
+		fPath, err := c.ConfigFilePath(*configRef)
245 245
 		if err != nil {
246 246
 			return errors.Wrap(err, "error getting config file path for container")
247 247
 		}
... ...
@@ -250,22 +250,22 @@ func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) {
250 250
 		}
251 251
 
252 252
 		logrus.WithFields(logrus.Fields{
253
-			"name": ref.File.Name,
253
+			"name": configRef.File.Name,
254 254
 			"path": fPath,
255 255
 		}).Debug("injecting config")
256
-		config, err := c.DependencyStore.Configs().Get(ref.ConfigID)
256
+		config, err := c.DependencyStore.Configs().Get(configRef.ConfigID)
257 257
 		if err != nil {
258 258
 			return errors.Wrap(err, "unable to get config from config store")
259 259
 		}
260
-		if err := ioutil.WriteFile(fPath, config.Spec.Data, ref.File.Mode); err != nil {
260
+		if err := ioutil.WriteFile(fPath, config.Spec.Data, configRef.File.Mode); err != nil {
261 261
 			return errors.Wrap(err, "error injecting config")
262 262
 		}
263 263
 
264
-		uid, err := strconv.Atoi(ref.File.UID)
264
+		uid, err := strconv.Atoi(configRef.File.UID)
265 265
 		if err != nil {
266 266
 			return err
267 267
 		}
268
-		gid, err := strconv.Atoi(ref.File.GID)
268
+		gid, err := strconv.Atoi(configRef.File.GID)
269 269
 		if err != nil {
270 270
 			return err
271 271
 		}
... ...
@@ -273,7 +273,7 @@ func (daemon *Daemon) setupSecretDir(c *container.Container) (setupErr error) {
273 273
 		if err := os.Chown(fPath, rootIDs.UID+uid, rootIDs.GID+gid); err != nil {
274 274
 			return errors.Wrap(err, "error setting ownership for config")
275 275
 		}
276
-		if err := os.Chmod(fPath, ref.File.Mode); err != nil {
276
+		if err := os.Chmod(fPath, configRef.File.Mode); err != nil {
277 277
 			return errors.Wrap(err, "error setting file mode for config")
278 278
 		}
279 279
 	}