فهرست منبع

Switch back some Errorf to Debugf.

Guillaume J. Charmes 11 سال پیش
والد
کامیت
c2175ae736
3فایلهای تغییر یافته به همراه12 افزوده شده و 5 حذف شده
  1. 4 2
      buildfile.go
  2. 5 1
      commands.go
  3. 3 2
      container.go

+ 4 - 2
buildfile.go

@@ -176,7 +176,9 @@ func (b *buildFile) CmdEnv(args string) error {
 func (b *buildFile) CmdCmd(args string) error {
 func (b *buildFile) CmdCmd(args string) error {
 	var cmd []string
 	var cmd []string
 	if err := json.Unmarshal([]byte(args), &cmd); err != nil {
 	if err := json.Unmarshal([]byte(args), &cmd); err != nil {
-		utils.Errorf("Error unmarshalling: %s, setting cmd to /bin/sh -c", err)
+		// If the unmarshal fails, it is not an error, we just use the
+		// args as a string.
+		utils.Debugf("Error unmarshalling: %s, setting cmd to /bin/sh -c", err)
 		cmd = []string{"/bin/sh", "-c", args}
 		cmd = []string{"/bin/sh", "-c", args}
 	}
 	}
 	if err := b.commit("", cmd, fmt.Sprintf("CMD %v", cmd)); err != nil {
 	if err := b.commit("", cmd, fmt.Sprintf("CMD %v", cmd)); err != nil {
@@ -296,7 +298,7 @@ func (b *buildFile) addContext(container *Container, orig, dest string) error {
 		}
 		}
 		// First try to unpack the source as an archive
 		// First try to unpack the source as an archive
 	} else if err := UntarPath(origPath, destPath); err != nil {
 	} else if err := UntarPath(origPath, destPath); err != nil {
-		utils.Errorf("Couldn't untar %s to %s: %s", origPath, destPath, err)
+		utils.Debugf("[tar] Not a directory nor a tar archive. Copying as a file. Untar error from %s to %s: %s", origPath, destPath, err)
 		// If that fails, just copy it as a regular file
 		// If that fails, just copy it as a regular file
 		if err := os.MkdirAll(path.Dir(destPath), 0755); err != nil {
 		if err := os.MkdirAll(path.Dir(destPath), 0755); err != nil {
 			return err
 			return err

+ 5 - 1
commands.go

@@ -1539,7 +1539,11 @@ func (cli *DockerCli) CmdRun(args ...string) error {
 	if config.AttachStdin || config.AttachStdout || config.AttachStderr {
 	if config.AttachStdin || config.AttachStdout || config.AttachStderr {
 		if config.Tty {
 		if config.Tty {
 			if err := cli.monitorTtySize(runResult.ID); err != nil {
 			if err := cli.monitorTtySize(runResult.ID); err != nil {
-				utils.Errorf("Error monitoring TTY size: %s\n", err)
+				// When running the test suite, there is no terminal, just pipes.
+				// Discard the error then.
+				if os.Getenv("TEST") != "1" {
+					utils.Errorf("Error monitoring TTY size: %s\n", err)
+				}
 			}
 			}
 		}
 		}
 
 

+ 3 - 2
container.go

@@ -979,12 +979,13 @@ func (container *Container) monitor(hostConfig *HostConfig) {
 	// If the command does not exists, try to wait via lxc
 	// If the command does not exists, try to wait via lxc
 	if container.cmd == nil {
 	if container.cmd == nil {
 		if err := container.waitLxc(); err != nil {
 		if err := container.waitLxc(); err != nil {
-			utils.Errorf("%s: Process: %s", container.ID, err)
+			// Discard the error as any signals or non 0 returns will generate an error
+			utils.Debugf("%s: Process: %s", container.ShortID(), err)
 		}
 		}
 	} else {
 	} else {
 		if err := container.cmd.Wait(); err != nil {
 		if err := container.cmd.Wait(); err != nil {
 			// Discard the error as any signals or non 0 returns will generate an error
 			// Discard the error as any signals or non 0 returns will generate an error
-			utils.Errorf("%s: Process: %s", container.ID, err)
+			utils.Debugf("%s: Process: %s", container.ShortID(), err)
 		}
 		}
 	}
 	}
 	utils.Debugf("Process finished")
 	utils.Debugf("Process finished")