This function was added in 7405ac5c2d as
a fallback for API < v1.41, which did not include the service status
in the response. Current API versions return this information, so there's
no need to fetch it manually.
It was not gated by API version for some tests (which didn't set API
version), but should not be needed for non-test situations.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
19 lines
550 B
Go
19 lines
550 B
Go
package stack
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/moby/moby/api/types/swarm"
|
|
"github.com/moby/moby/client"
|
|
)
|
|
|
|
// getServices is the swarm implementation of listing stack services
|
|
func getServices(ctx context.Context, apiClient client.APIClient, opts serviceListOptions) ([]swarm.Service, error) {
|
|
return apiClient.ServiceList(ctx, client.ServiceListOptions{
|
|
Filters: getStackFilterFromOpt(opts.namespace, opts.filter),
|
|
// When not running "quiet", also get service status (number of running
|
|
// and desired tasks).
|
|
Status: !opts.quiet,
|
|
})
|
|
}
|