In #28507 and #28885, `docker service/node ps -a` has been removed so that
information about slots are show up even without `-a` flag.
The output of `docker stack ps` reused the same output as `docker service/node ps`.
However, the `-a` was still there. It might make sense to remove `docker stack ps -a`
as well to bring consistency with `docker service/node ps`.
This fix is related to #28507, #28885, and #25983.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
| ... | ... |
@@ -6,7 +6,6 @@ import ( |
| 6 | 6 |
"golang.org/x/net/context" |
| 7 | 7 |
|
| 8 | 8 |
"github.com/docker/docker/api/types" |
| 9 |
- "github.com/docker/docker/api/types/swarm" |
|
| 10 | 9 |
"github.com/docker/docker/cli" |
| 11 | 10 |
"github.com/docker/docker/cli/command" |
| 12 | 11 |
"github.com/docker/docker/cli/command/idresolver" |
| ... | ... |
@@ -16,7 +15,6 @@ import ( |
| 16 | 16 |
) |
| 17 | 17 |
|
| 18 | 18 |
type psOptions struct {
|
| 19 |
- all bool |
|
| 20 | 19 |
filter opts.FilterOpt |
| 21 | 20 |
noTrunc bool |
| 22 | 21 |
namespace string |
| ... | ... |
@@ -36,7 +34,6 @@ func newPsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
| 36 | 36 |
}, |
| 37 | 37 |
} |
| 38 | 38 |
flags := cmd.Flags() |
| 39 |
- flags.BoolVarP(&opts.all, "all", "a", false, "Display all tasks") |
|
| 40 | 39 |
flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output") |
| 41 | 40 |
flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names") |
| 42 | 41 |
flags.VarP(&opts.filter, "filter", "f", "Filter output based on conditions provided") |
| ... | ... |
@@ -50,10 +47,6 @@ func runPS(dockerCli *command.DockerCli, opts psOptions) error {
|
| 50 | 50 |
ctx := context.Background() |
| 51 | 51 |
|
| 52 | 52 |
filter := getStackFilterFromOpt(opts.namespace, opts.filter) |
| 53 |
- if !opts.all && !filter.Include("desired-state") {
|
|
| 54 |
- filter.Add("desired-state", string(swarm.TaskStateRunning))
|
|
| 55 |
- filter.Add("desired-state", string(swarm.TaskStateAccepted))
|
|
| 56 |
- } |
|
| 57 | 53 |
|
| 58 | 54 |
tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
|
| 59 | 55 |
if err != nil {
|
| ... | ... |
@@ -21,10 +21,10 @@ Usage: docker stack ps [OPTIONS] STACK |
| 21 | 21 |
List the tasks in the stack |
| 22 | 22 |
|
| 23 | 23 |
Options: |
| 24 |
- -a, --all Display all tasks |
|
| 25 |
- -f, --filter value Filter output based on conditions provided |
|
| 26 |
- --no-resolve Do not map IDs to Names |
|
| 27 |
- --no-trunc Do not truncate output |
|
| 24 |
+ -f, --filter filter Filter output based on conditions provided |
|
| 25 |
+ --help Print usage |
|
| 26 |
+ --no-resolve Do not map IDs to Names |
|
| 27 |
+ --no-trunc Do not truncate output |
|
| 28 | 28 |
``` |
| 29 | 29 |
|
| 30 | 30 |
Lists the tasks that are running as part of the specified stack. This |