Explorar o código

`docker ps --filter status=exited should not require passing -a`

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
Jessica Frazelle %!s(int64=10) %!d(string=hai) anos
pai
achega
2639e073b1
Modificáronse 2 ficheiros con 9 adicións e 1 borrados
  1. 8 0
      daemon/list.go
  2. 1 1
      integration-cli/docker_cli_ps_test.go

+ 8 - 0
daemon/list.go

@@ -45,6 +45,14 @@ func (daemon *Daemon) Containers(job *engine.Job) engine.Status {
 		}
 	}
 
+	if i, ok := psFilters["status"]; ok {
+		for _, value := range i {
+			if value == "exited" {
+				all = true
+			}
+		}
+	}
+
 	names := map[string][]string{}
 	daemon.ContainerGraph().Walk("/", func(p string, e *graphdb.Entity) error {
 		names[e.ID()] = append(names[e.ID()], p)

+ 1 - 1
integration-cli/docker_cli_ps_test.go

@@ -312,7 +312,7 @@ func TestPsListContainersFilterStatus(t *testing.T) {
 	secondID := stripTrailingCharacters(out)
 
 	// filter containers by exited
-	runCmd = exec.Command(dockerBinary, "ps", "-a", "-q", "--filter=status=exited")
+	runCmd = exec.Command(dockerBinary, "ps", "-q", "--filter=status=exited")
 	out, _, err = runCommandWithOutput(runCmd)
 	if err != nil {
 		t.Fatal(out, err)