Browse code

another commit to do like @crosbymichael

Signed-off-by: Victor Vieux <vieux@docker.com>

Victor Vieux authored on 2014/08/14 10:36:26
Showing 11 changed files
... ...
@@ -434,11 +434,11 @@ func (cli *DockerCli) CmdVersion(args ...string) error {
434 434
 	out := engine.NewOutput()
435 435
 	remoteVersion, err := out.AddEnv()
436 436
 	if err != nil {
437
-		log.Errorf("Error reading remote version: %s\n", err)
437
+		log.Errorf("Error reading remote version: %s", err)
438 438
 		return err
439 439
 	}
440 440
 	if _, err := out.Write(body); err != nil {
441
-		log.Errorf("Error reading remote version: %s\n", err)
441
+		log.Errorf("Error reading remote version: %s", err)
442 442
 		return err
443 443
 	}
444 444
 	out.Close()
... ...
@@ -474,7 +474,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
474 474
 	}
475 475
 
476 476
 	if _, err := out.Write(body); err != nil {
477
-		log.Errorf("Error reading remote info: %s\n", err)
477
+		log.Errorf("Error reading remote info: %s", err)
478 478
 		return err
479 479
 	}
480 480
 	out.Close()
... ...
@@ -691,7 +691,7 @@ func (cli *DockerCli) CmdStart(args ...string) error {
691 691
 	if *openStdin || *attach {
692 692
 		if tty && cli.isTerminal {
693 693
 			if err := cli.monitorTtySize(cmd.Arg(0)); err != nil {
694
-				log.Errorf("Error monitoring TTY size: %s\n", err)
694
+				log.Errorf("Error monitoring TTY size: %s", err)
695 695
 			}
696 696
 		}
697 697
 		return <-cErr
... ...
@@ -2159,7 +2159,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
2159 2159
 
2160 2160
 	if (config.AttachStdin || config.AttachStdout || config.AttachStderr) && config.Tty && cli.isTerminal {
2161 2161
 		if err := cli.monitorTtySize(runResult.Get("Id")); err != nil {
2162
-			log.Errorf("Error monitoring TTY size: %s\n", err)
2162
+			log.Errorf("Error monitoring TTY size: %s", err)
2163 2163
 		}
2164 2164
 	}
2165 2165
 
... ...
@@ -106,11 +106,11 @@ func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.Rea
106 106
 		}
107 107
 		if tcpc, ok := rwc.(*net.TCPConn); ok {
108 108
 			if err := tcpc.CloseWrite(); err != nil {
109
-				log.Debugf("Couldn't send EOF: %s\n", err)
109
+				log.Debugf("Couldn't send EOF: %s", err)
110 110
 			}
111 111
 		} else if unixc, ok := rwc.(*net.UnixConn); ok {
112 112
 			if err := unixc.CloseWrite(); err != nil {
113
-				log.Debugf("Couldn't send EOF: %s\n", err)
113
+				log.Debugf("Couldn't send EOF: %s", err)
114 114
 			}
115 115
 		}
116 116
 		// Discard errors due to pipe interruption
... ...
@@ -342,7 +342,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
342 342
 		for _, include := range options.Includes {
343 343
 			filepath.Walk(filepath.Join(srcPath, include), func(filePath string, f os.FileInfo, err error) error {
344 344
 				if err != nil {
345
-					log.Debugf("Tar: Can't stat file %s to tar: %s\n", srcPath, err)
345
+					log.Debugf("Tar: Can't stat file %s to tar: %s", srcPath, err)
346 346
 					return nil
347 347
 				}
348 348
 
... ...
@@ -353,7 +353,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
353 353
 
354 354
 				skip, err := utils.Matches(relFilePath, options.Excludes)
355 355
 				if err != nil {
356
-					log.Debugf("Error matching %s\n", relFilePath, err)
356
+					log.Debugf("Error matching %s", relFilePath, err)
357 357
 					return err
358 358
 				}
359 359
 
... ...
@@ -365,7 +365,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
365 365
 				}
366 366
 
367 367
 				if err := addTarFile(filePath, relFilePath, tw, twBuf); err != nil {
368
-					log.Debugf("Can't add file %s to tar: %s\n", srcPath, err)
368
+					log.Debugf("Can't add file %s to tar: %s", srcPath, err)
369 369
 				}
370 370
 				return nil
371 371
 			})
... ...
@@ -373,13 +373,13 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
373 373
 
374 374
 		// Make sure to check the error on Close.
375 375
 		if err := tw.Close(); err != nil {
376
-			log.Debugf("Can't close tar writer: %s\n", err)
376
+			log.Debugf("Can't close tar writer: %s", err)
377 377
 		}
378 378
 		if err := compressWriter.Close(); err != nil {
379
-			log.Debugf("Can't close compress writer: %s\n", err)
379
+			log.Debugf("Can't close compress writer: %s", err)
380 380
 		}
381 381
 		if err := pipeWriter.Close(); err != nil {
382
-			log.Debugf("Can't close pipe writer: %s\n", err)
382
+			log.Debugf("Can't close pipe writer: %s", err)
383 383
 		}
384 384
 	}()
385 385
 
... ...
@@ -364,19 +364,19 @@ func ExportChanges(dir string, changes []Change) (Archive, error) {
364 364
 					ChangeTime: timestamp,
365 365
 				}
366 366
 				if err := tw.WriteHeader(hdr); err != nil {
367
-					log.Debugf("Can't write whiteout header: %s\n", err)
367
+					log.Debugf("Can't write whiteout header: %s", err)
368 368
 				}
369 369
 			} else {
370 370
 				path := filepath.Join(dir, change.Path)
371 371
 				if err := addTarFile(path, change.Path[1:], tw, twBuf); err != nil {
372
-					log.Debugf("Can't add file %s to tar: %s\n", path, err)
372
+					log.Debugf("Can't add file %s to tar: %s", path, err)
373 373
 				}
374 374
 			}
375 375
 		}
376 376
 
377 377
 		// Make sure to check the error on Close.
378 378
 		if err := tw.Close(); err != nil {
379
-			log.Debugf("Can't close layer: %s\n", err)
379
+			log.Debugf("Can't close layer: %s", err)
380 380
 		}
381 381
 		writer.Close()
382 382
 	}()
... ...
@@ -210,7 +210,7 @@ func (a *Driver) Remove(id string) error {
210 210
 	defer a.Unlock()
211 211
 
212 212
 	if a.active[id] != 0 {
213
-		log.Errorf("Warning: removing active id %s\n", id)
213
+		log.Errorf("Warning: removing active id %s", id)
214 214
 	}
215 215
 
216 216
 	// Make sure the dir is umounted first
... ...
@@ -596,7 +596,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
596 596
 
597 597
 			data, err := devices.ensureImage("data", devices.dataLoopbackSize)
598 598
 			if err != nil {
599
-				log.Debugf("Error device ensureImage (data): %s\n", err)
599
+				log.Debugf("Error device ensureImage (data): %s", err)
600 600
 				return err
601 601
 			}
602 602
 
... ...
@@ -627,7 +627,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
627 627
 
628 628
 			metadata, err := devices.ensureImage("metadata", devices.metaDataLoopbackSize)
629 629
 			if err != nil {
630
-				log.Debugf("Error device ensureImage (metadata): %s\n", err)
630
+				log.Debugf("Error device ensureImage (metadata): %s", err)
631 631
 				return err
632 632
 			}
633 633
 
... ...
@@ -659,7 +659,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
659 659
 	// Setup the base image
660 660
 	if doInit {
661 661
 		if err := devices.setupBaseImage(); err != nil {
662
-			log.Debugf("Error device setupBaseImage: %s\n", err)
662
+			log.Debugf("Error device setupBaseImage: %s", err)
663 663
 			return err
664 664
 		}
665 665
 	}
... ...
@@ -686,7 +686,7 @@ func (devices *DeviceSet) AddDevice(hash, baseHash string) error {
686 686
 	deviceId := devices.nextDeviceId
687 687
 
688 688
 	if err := createSnapDevice(devices.getPoolDevName(), &deviceId, baseInfo.Name(), baseInfo.DeviceId); err != nil {
689
-		log.Debugf("Error creating snap device: %s\n", err)
689
+		log.Debugf("Error creating snap device: %s", err)
690 690
 		return err
691 691
 	}
692 692
 
... ...
@@ -695,7 +695,7 @@ func (devices *DeviceSet) AddDevice(hash, baseHash string) error {
695 695
 
696 696
 	if _, err := devices.registerDevice(deviceId, hash, baseInfo.Size); err != nil {
697 697
 		deleteDevice(devices.getPoolDevName(), deviceId)
698
-		log.Debugf("Error registering device: %s\n", err)
698
+		log.Debugf("Error registering device: %s", err)
699 699
 		return err
700 700
 	}
701 701
 	return nil
... ...
@@ -708,7 +708,7 @@ func (devices *DeviceSet) deleteDevice(info *DevInfo) error {
708 708
 		// manually
709 709
 		if err := devices.activateDeviceIfNeeded(info); err == nil {
710 710
 			if err := BlockDeviceDiscard(info.DevName()); err != nil {
711
-				log.Debugf("Error discarding block on device: %s (ignoring)\n", err)
711
+				log.Debugf("Error discarding block on device: %s (ignoring)", err)
712 712
 			}
713 713
 		}
714 714
 	}
... ...
@@ -716,13 +716,13 @@ func (devices *DeviceSet) deleteDevice(info *DevInfo) error {
716 716
 	devinfo, _ := getInfo(info.Name())
717 717
 	if devinfo != nil && devinfo.Exists != 0 {
718 718
 		if err := devices.removeDeviceAndWait(info.Name()); err != nil {
719
-			log.Debugf("Error removing device: %s\n", err)
719
+			log.Debugf("Error removing device: %s", err)
720 720
 			return err
721 721
 		}
722 722
 	}
723 723
 
724 724
 	if err := deleteDevice(devices.getPoolDevName(), info.DeviceId); err != nil {
725
-		log.Debugf("Error deleting device: %s\n", err)
725
+		log.Debugf("Error deleting device: %s", err)
726 726
 		return err
727 727
 	}
728 728
 
... ...
@@ -735,7 +735,7 @@ func (devices *DeviceSet) deleteDevice(info *DevInfo) error {
735 735
 		devices.devicesLock.Lock()
736 736
 		devices.Devices[info.Hash] = info
737 737
 		devices.devicesLock.Unlock()
738
-		log.Debugf("Error removing meta data: %s\n", err)
738
+		log.Debugf("Error removing meta data: %s", err)
739 739
 		return err
740 740
 	}
741 741
 
... ...
@@ -779,7 +779,7 @@ func (devices *DeviceSet) deactivateDevice(info *DevInfo) error {
779 779
 	// Wait for the unmount to be effective,
780 780
 	// by watching the value of Info.OpenCount for the device
781 781
 	if err := devices.waitClose(info); err != nil {
782
-		log.Errorf("Warning: error waiting for device %s to close: %s\n", info.Hash, err)
782
+		log.Errorf("Warning: error waiting for device %s to close: %s", info.Hash, err)
783 783
 	}
784 784
 
785 785
 	devinfo, err := getInfo(info.Name())
... ...
@@ -903,12 +903,12 @@ func (devices *DeviceSet) Shutdown() error {
903 903
 			// container. This means it'll go away from the global scope directly,
904 904
 			// and the device will be released when that container dies.
905 905
 			if err := syscall.Unmount(info.mountPath, syscall.MNT_DETACH); err != nil {
906
-				log.Debugf("Shutdown unmounting %s, error: %s\n", info.mountPath, err)
906
+				log.Debugf("Shutdown unmounting %s, error: %s", info.mountPath, err)
907 907
 			}
908 908
 
909 909
 			devices.Lock()
910 910
 			if err := devices.deactivateDevice(info); err != nil {
911
-				log.Debugf("Shutdown deactivate %s , error: %s\n", info.Hash, err)
911
+				log.Debugf("Shutdown deactivate %s , error: %s", info.Hash, err)
912 912
 			}
913 913
 			devices.Unlock()
914 914
 		}
... ...
@@ -920,7 +920,7 @@ func (devices *DeviceSet) Shutdown() error {
920 920
 		info.lock.Lock()
921 921
 		devices.Lock()
922 922
 		if err := devices.deactivateDevice(info); err != nil {
923
-			log.Debugf("Shutdown deactivate base , error: %s\n", err)
923
+			log.Debugf("Shutdown deactivate base , error: %s", err)
924 924
 		}
925 925
 		devices.Unlock()
926 926
 		info.lock.Unlock()
... ...
@@ -928,7 +928,7 @@ func (devices *DeviceSet) Shutdown() error {
928 928
 
929 929
 	devices.Lock()
930 930
 	if err := devices.deactivatePool(); err != nil {
931
-		log.Debugf("Shutdown deactivate pool , error: %s\n", err)
931
+		log.Debugf("Shutdown deactivate pool , error: %s", err)
932 932
 	}
933 933
 	devices.Unlock()
934 934
 
... ...
@@ -198,7 +198,7 @@ func (t *Task) GetNextTarget(next uintptr) (nextPtr uintptr, start uint64,
198 198
 func getLoopbackBackingFile(file *os.File) (uint64, uint64, error) {
199 199
 	loopInfo, err := ioctlLoopGetStatus64(file.Fd())
200 200
 	if err != nil {
201
-		log.Errorf("Error get loopback backing file: %s\n", err)
201
+		log.Errorf("Error get loopback backing file: %s", err)
202 202
 		return 0, 0, ErrGetLoopbackBackingFile
203 203
 	}
204 204
 	return loopInfo.loDevice, loopInfo.loInode, nil
... ...
@@ -138,7 +138,7 @@ func (d *Driver) Get(id, mountLabel string) (string, error) {
138 138
 
139 139
 func (d *Driver) Put(id string) {
140 140
 	if err := d.DeviceSet.UnmountDevice(id); err != nil {
141
-		log.Errorf("Warning: error unmounting device %s: %s\n", id, err)
141
+		log.Errorf("Warning: error unmounting device %s: %s", id, err)
142 142
 	}
143 143
 }
144 144
 
... ...
@@ -88,7 +88,7 @@ func (m *containerMonitor) Close() error {
88 88
 	// because they share same runconfig and change image. Must be fixed
89 89
 	// in builder/builder.go
90 90
 	if err := m.container.toDisk(); err != nil {
91
-		log.Errorf("Error dumping container %s state to disk: %s\n", m.container.ID, err)
91
+		log.Errorf("Error dumping container %s state to disk: %s", m.container.ID, err)
92 92
 
93 93
 		return err
94 94
 	}
... ...
@@ -97,9 +97,9 @@ func (s *TagStore) pushRepository(r *registry.Session, out io.Writer, localName,
97 97
 		}
98 98
 	}
99 99
 
100
-	log.Debugf("Preparing to push %s with the following images and tags\n", localRepo)
100
+	log.Debugf("Preparing to push %s with the following images and tags", localRepo)
101 101
 	for _, data := range imageIndex {
102
-		log.Debugf("Pushing ID: %s with Tag: %s\n", data.ID, data.Tag)
102
+		log.Debugf("Pushing ID: %s with Tag: %s", data.ID, data.Tag)
103 103
 	}
104 104
 
105 105
 	// Register all the images in a repository with the registry
... ...
@@ -107,16 +107,16 @@ func init() {
107 107
 	if dockerinit := os.Getenv("TEST_DOCKERINIT_PATH"); dockerinit != "" {
108 108
 		src, err := os.Open(dockerinit)
109 109
 		if err != nil {
110
-			log.Fatalf("Unable to open TEST_DOCKERINIT_PATH: %s\n", err)
110
+			log.Fatalf("Unable to open TEST_DOCKERINIT_PATH: %s", err)
111 111
 		}
112 112
 		defer src.Close()
113 113
 		dst, err := os.OpenFile(filepath.Join(filepath.Dir(utils.SelfPath()), "dockerinit"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0555)
114 114
 		if err != nil {
115
-			log.Fatalf("Unable to create dockerinit in test directory: %s\n", err)
115
+			log.Fatalf("Unable to create dockerinit in test directory: %s", err)
116 116
 		}
117 117
 		defer dst.Close()
118 118
 		if _, err := io.Copy(dst, src); err != nil {
119
-			log.Fatalf("Unable to copy dockerinit to TEST_DOCKERINIT_PATH: %s\n", err)
119
+			log.Fatalf("Unable to copy dockerinit to TEST_DOCKERINIT_PATH: %s", err)
120 120
 		}
121 121
 		dst.Close()
122 122
 		src.Close()