mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Revert "Add -a option to service/node ps"
This reverts commit 139fff2bf0
.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
783d4ac6d4
commit
eb55d03f3c
5 changed files with 1 additions and 99 deletions
|
@ -17,7 +17,6 @@ import (
|
|||
|
||||
type psOptions struct {
|
||||
nodeIDs []string
|
||||
all bool
|
||||
noResolve bool
|
||||
noTrunc bool
|
||||
filter opts.FilterOpt
|
||||
|
@ -44,7 +43,6 @@ func newPsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|||
flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output")
|
||||
flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names")
|
||||
flags.VarP(&opts.filter, "filter", "f", "Filter output based on conditions provided")
|
||||
flags.BoolVarP(&opts.all, "all", "a", false, "Show all tasks (default shows tasks that are or will be running)")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
@ -74,11 +72,6 @@ func runPs(dockerCli *command.DockerCli, opts psOptions) error {
|
|||
filter := opts.filter.Value()
|
||||
filter.Add("node", node.ID)
|
||||
|
||||
if !opts.all && !filter.Include("desired-state") {
|
||||
filter.Add("desired-state", string(swarm.TaskStateRunning))
|
||||
filter.Add("desired-state", string(swarm.TaskStateAccepted))
|
||||
}
|
||||
|
||||
nodeTasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
|
||||
if err != nil {
|
||||
errs = append(errs, err.Error())
|
||||
|
|
|
@ -2,7 +2,6 @@ package service
|
|||
|
||||
import (
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/cli/command"
|
||||
"github.com/docker/docker/cli/command/idresolver"
|
||||
|
@ -15,7 +14,6 @@ import (
|
|||
|
||||
type psOptions struct {
|
||||
serviceID string
|
||||
all bool
|
||||
quiet bool
|
||||
noResolve bool
|
||||
noTrunc bool
|
||||
|
@ -39,7 +37,6 @@ func newPsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|||
flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output")
|
||||
flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names")
|
||||
flags.VarP(&opts.filter, "filter", "f", "Filter output based on conditions provided")
|
||||
flags.BoolVarP(&opts.all, "all", "a", false, "Show all tasks (default shows tasks that are or will be running)")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
@ -67,11 +64,6 @@ func runPS(dockerCli *command.DockerCli, opts psOptions) error {
|
|||
}
|
||||
}
|
||||
|
||||
if !opts.all && !filter.Include("desired-state") {
|
||||
filter.Add("desired-state", string(swarm.TaskStateRunning))
|
||||
filter.Add("desired-state", string(swarm.TaskStateAccepted))
|
||||
}
|
||||
|
||||
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -22,7 +22,7 @@ Usage: docker node ps [OPTIONS] [NODE...]
|
|||
List tasks running on one or more nodes, defaults to current node.
|
||||
|
||||
Options:
|
||||
-a, --all Show all tasks (default shows tasks that are or will be running)
|
||||
-a, --all Display all instances
|
||||
-f, --filter value Filter output based on conditions provided
|
||||
--help Print usage
|
||||
--no-resolve Do not map IDs to Names
|
||||
|
|
|
@ -22,7 +22,6 @@ Usage: docker service ps [OPTIONS] SERVICE
|
|||
List the tasks of a service
|
||||
|
||||
Options:
|
||||
-a, --all Show all tasks (default shows tasks that are or will be running)
|
||||
-f, --filter filter Filter output based on conditions provided
|
||||
--help Print usage
|
||||
--no-resolve Do not map IDs to Names
|
||||
|
|
|
@ -219,88 +219,6 @@ func (s *DockerSwarmSuite) TestSwarmNodeTaskListFilter(c *check.C) {
|
|||
c.Assert(out, checker.Not(checker.Contains), name+".1")
|
||||
c.Assert(out, checker.Not(checker.Contains), name+".2")
|
||||
c.Assert(out, checker.Not(checker.Contains), name+".3")
|
||||
|
||||
out, err = d.Cmd("node", "ps", "--filter", "desired-state=running", "self")
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Contains, name+".1")
|
||||
c.Assert(out, checker.Contains, name+".2")
|
||||
c.Assert(out, checker.Contains, name+".3")
|
||||
|
||||
out, err = d.Cmd("node", "ps", "--filter", "desired-state=shutdown", "self")
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Not(checker.Contains), name+".1")
|
||||
c.Assert(out, checker.Not(checker.Contains), name+".2")
|
||||
c.Assert(out, checker.Not(checker.Contains), name+".3")
|
||||
}
|
||||
|
||||
func (s *DockerSwarmSuite) TestSwarmServiceTaskListAll(c *check.C) {
|
||||
d := s.AddDaemon(c, true, true)
|
||||
|
||||
name := "service-task-list-1"
|
||||
out, err := d.Cmd("service", "create", "--name", name, "--replicas=3", "busybox", "top")
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
||||
|
||||
// make sure task has been deployed.
|
||||
waitAndAssert(c, defaultReconciliationTimeout, d.checkActiveContainerCount, checker.Equals, 3)
|
||||
|
||||
out, err = d.Cmd("service", "ps", name)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Contains, name+".1")
|
||||
c.Assert(out, checker.Contains, name+".2")
|
||||
c.Assert(out, checker.Contains, name+".3")
|
||||
|
||||
// Get the last container id so we can restart it to cause a task error in the history
|
||||
containerID, err := d.Cmd("ps", "-q", "-l")
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
_, err = d.Cmd("stop", strings.TrimSpace(containerID))
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
waitAndAssert(c, defaultReconciliationTimeout, d.checkActiveContainerCount, checker.Equals, 3)
|
||||
|
||||
out, err = d.Cmd("service", "ps", name)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Count, name, 3)
|
||||
|
||||
out, err = d.Cmd("service", "ps", name, "-a")
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Count, name, 4)
|
||||
}
|
||||
|
||||
func (s *DockerSwarmSuite) TestSwarmNodeTaskListAll(c *check.C) {
|
||||
d := s.AddDaemon(c, true, true)
|
||||
|
||||
name := "node-task-list"
|
||||
out, err := d.Cmd("service", "create", "--name", name, "--replicas=3", "busybox", "top")
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
|
||||
|
||||
// make sure task has been deployed.
|
||||
waitAndAssert(c, defaultReconciliationTimeout, d.checkActiveContainerCount, checker.Equals, 3)
|
||||
|
||||
out, err = d.Cmd("service", "ps", name)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Contains, name+".1")
|
||||
c.Assert(out, checker.Contains, name+".2")
|
||||
c.Assert(out, checker.Contains, name+".3")
|
||||
|
||||
// Get the last container id so we can restart it to cause a task error in the history
|
||||
containerID, err := d.Cmd("ps", "-q", "-l")
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
_, err = d.Cmd("stop", strings.TrimSpace(containerID))
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
waitAndAssert(c, defaultReconciliationTimeout, d.checkActiveContainerCount, checker.Equals, 3)
|
||||
|
||||
out, err = d.Cmd("node", "ps", "self")
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Count, name, 3)
|
||||
|
||||
out, err = d.Cmd("node", "ps", "self", "-a")
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(out, checker.Count, name, 4)
|
||||
}
|
||||
|
||||
// Test case for #25375
|
||||
|
|
Loading…
Reference in a new issue