mirror of https://github.com/docker/cli.git
Merge pull request #28885 from vdemeester/revert-service-ps-all
Revert "Add -a option to service/node ps"
This commit is contained in:
commit
d94d204f97
|
@ -17,7 +17,6 @@ import (
|
||||||
|
|
||||||
type psOptions struct {
|
type psOptions struct {
|
||||||
nodeIDs []string
|
nodeIDs []string
|
||||||
all bool
|
|
||||||
noResolve bool
|
noResolve bool
|
||||||
noTrunc bool
|
noTrunc bool
|
||||||
filter opts.FilterOpt
|
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.noTrunc, "no-trunc", false, "Do not truncate output")
|
||||||
flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names")
|
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.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
|
return cmd
|
||||||
}
|
}
|
||||||
|
@ -74,11 +72,6 @@ func runPs(dockerCli *command.DockerCli, opts psOptions) error {
|
||||||
filter := opts.filter.Value()
|
filter := opts.filter.Value()
|
||||||
filter.Add("node", node.ID)
|
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})
|
nodeTasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs = append(errs, err.Error())
|
errs = append(errs, err.Error())
|
||||||
|
|
|
@ -2,7 +2,6 @@ package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/swarm"
|
|
||||||
"github.com/docker/docker/cli"
|
"github.com/docker/docker/cli"
|
||||||
"github.com/docker/docker/cli/command"
|
"github.com/docker/docker/cli/command"
|
||||||
"github.com/docker/docker/cli/command/idresolver"
|
"github.com/docker/docker/cli/command/idresolver"
|
||||||
|
@ -15,7 +14,6 @@ import (
|
||||||
|
|
||||||
type psOptions struct {
|
type psOptions struct {
|
||||||
serviceID string
|
serviceID string
|
||||||
all bool
|
|
||||||
quiet bool
|
quiet bool
|
||||||
noResolve bool
|
noResolve bool
|
||||||
noTrunc 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.noTrunc, "no-trunc", false, "Do not truncate output")
|
||||||
flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names")
|
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.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
|
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})
|
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue