Bladeren bron

Remove ArgsAsString because its a util function
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)

Michael Crosby 11 jaren geleden
bovenliggende
commit
9bd7d09871
2 gewijzigde bestanden met toevoegingen van 11 en 13 verwijderingen
  1. 0 12
      runtime/container.go
  2. 11 1
      server/server.go

+ 0 - 12
runtime/container.go

@@ -365,18 +365,6 @@ func populateCommand(c *Container, env []string) {
 	c.command.Env = env
 }
 
-func (container *Container) ArgsAsString() string {
-	var args []string
-	for _, arg := range container.Args {
-		if strings.Contains(arg, " ") {
-			args = append(args, fmt.Sprintf("'%s'", arg))
-		} else {
-			args = append(args, arg)
-		}
-	}
-	return strings.Join(args, " ")
-}
-
 func (container *Container) Start() (err error) {
 	container.Lock()
 	defer container.Unlock()

+ 11 - 1
server/server.go

@@ -1063,7 +1063,17 @@ func (srv *Server) Containers(job *engine.Job) engine.Status {
 		out.SetList("Names", names[container.ID])
 		out.Set("Image", srv.runtime.Repositories().ImageName(container.Image))
 		if len(container.Args) > 0 {
-			out.Set("Command", fmt.Sprintf("\"%s %s\"", container.Path, container.ArgsAsString()))
+			args := []string{}
+			for _, arg := range container.Args {
+				if strings.Contains(arg, " ") {
+					args = append(args, fmt.Sprintf("'%s'", arg))
+				} else {
+					args = append(args, arg)
+				}
+			}
+			argsAsString := strings.Join(args, " ")
+
+			out.Set("Command", fmt.Sprintf("\"%s %s\"", container.Path, argsAsString))
 		} else {
 			out.Set("Command", fmt.Sprintf("\"%s\"", container.Path))
 		}