From d761719eb4e45fbd6f092f6d0b4eb42206e298f6 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 29 Jun 2016 09:20:32 -0700 Subject: [PATCH] rename desired_state filter to desired-state For consistency with other filters (such as "is-official"), this renames the desired_state filter to "desired-state". Signed-off-by: Sebastiaan van Stijn --- api/client/node/tasks.go | 7 +++---- api/client/service/tasks.go | 6 +++--- api/client/stack/tasks.go | 6 +++--- daemon/cluster/filters.go | 6 +++--- docs/reference/commandline/node_tasks.md | 6 +++--- docs/reference/commandline/service_tasks.md | 6 +++--- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/api/client/node/tasks.go b/api/client/node/tasks.go index 8d45bc743d..4328437ae0 100644 --- a/api/client/node/tasks.go +++ b/api/client/node/tasks.go @@ -55,10 +55,9 @@ func runTasks(dockerCli *client.DockerCli, opts tasksOptions) 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)) - + 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( diff --git a/api/client/service/tasks.go b/api/client/service/tasks.go index 7520b1f16d..7966a544a7 100644 --- a/api/client/service/tasks.go +++ b/api/client/service/tasks.go @@ -51,9 +51,9 @@ func runTasks(dockerCli *client.DockerCli, opts tasksOptions) error { filter := opts.filter.Value() filter.Add("service", service.ID) - if !opts.all && !filter.Include("desired_state") { - filter.Add("desired_state", string(swarm.TaskStateRunning)) - filter.Add("desired_state", string(swarm.TaskStateAccepted)) + 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{Filter: filter}) diff --git a/api/client/stack/tasks.go b/api/client/stack/tasks.go index 5ed1fbae35..f9546bde4b 100644 --- a/api/client/stack/tasks.go +++ b/api/client/stack/tasks.go @@ -48,9 +48,9 @@ func runTasks(dockerCli *client.DockerCli, opts tasksOptions) error { filter := opts.filter.Value() filter.Add("label", labelNamespace+"="+opts.namespace) - if !opts.all && !filter.Include("desired_state") { - filter.Add("desired_state", string(swarm.TaskStateRunning)) - filter.Add("desired_state", string(swarm.TaskStateAccepted)) + 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{Filter: filter}) diff --git a/daemon/cluster/filters.go b/daemon/cluster/filters.go index 5890698d00..c982a2d0e8 100644 --- a/daemon/cluster/filters.go +++ b/daemon/cluster/filters.go @@ -68,7 +68,7 @@ func newListTasksFilters(filter filters.Args) (*swarmapi.ListTasksRequest_Filter "label": true, "service": true, "node": true, - "desired_state": true, + "desired-state": true, } if err := filter.Validate(accepted); err != nil { return nil, err @@ -81,11 +81,11 @@ func newListTasksFilters(filter filters.Args) (*swarmapi.ListTasksRequest_Filter NodeIDs: filter.Get("node"), } - for _, s := range filter.Get("desired_state") { + for _, s := range filter.Get("desired-state") { if state, ok := swarmapi.TaskState_value[strings.ToUpper(s)]; ok { f.DesiredStates = append(f.DesiredStates, swarmapi.TaskState(state)) } else if s != "" { - return nil, fmt.Errorf("Invalid desired_state filter: '%s'", s) + return nil, fmt.Errorf("Invalid desired-state filter: '%s'", s) } } diff --git a/docs/reference/commandline/node_tasks.md b/docs/reference/commandline/node_tasks.md index 3664db3e1f..bbfaeca6ea 100644 --- a/docs/reference/commandline/node_tasks.md +++ b/docs/reference/commandline/node_tasks.md @@ -44,7 +44,7 @@ The currently supported filters are: * [name](#name) * [id](#id) * [label](#label) -* [desired_state](#desired_state) +* [desired-state](#desired-state) #### name @@ -85,9 +85,9 @@ bg8c07zzg87di2mufeq51a2qp redis.7 redis redis:3.0.6 Running 9 minutes Ru ``` -#### desired_state +#### desired-state -The `desired_state` filter can take the values `running` and `accepted`. +The `desired-state` filter can take the values `running` and `accepted`. ## Related information diff --git a/docs/reference/commandline/service_tasks.md b/docs/reference/commandline/service_tasks.md index aa1d11a1ca..454a0edf63 100644 --- a/docs/reference/commandline/service_tasks.md +++ b/docs/reference/commandline/service_tasks.md @@ -60,7 +60,7 @@ The currently supported filters are: * [id](#id) * [name](#name) -* [desired_state](#desired_state) +* [desired-state](#desired-state) #### ID @@ -85,9 +85,9 @@ ID NAME SERVICE IMAGE DESIRED STATE LAST S ``` -#### desired_state +#### desired-state -The `desired_state` filter can take the values `running` and `accepted`. +The `desired-state` filter can take the values `running` and `accepted`. ## Related information