1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Add Swarm management backend

As described in our ROADMAP.md, introduce new Swarm management API
endpoints relying on swarmkit to deploy services. It currently vendors
docker/engine-api changes.

This PR is fully backward compatible (joining a Swarm is an optional
feature of the Engine, and existing commands are not impacted).

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
Tonis Tiigi 2016-06-13 19:52:49 -07:00
parent 44793049ce
commit 534a90a993
42 changed files with 4046 additions and 53 deletions

View file

@ -8,6 +8,7 @@ import (
"github.com/docker/engine-api/types"
"github.com/docker/engine-api/types/versions"
"github.com/gorilla/mux"
"google.golang.org/grpc"
)
// httpStatusError is an interface
@ -58,6 +59,7 @@ func GetHTTPErrorStatusCode(err error) int {
"wrong login/password": http.StatusUnauthorized,
"unauthorized": http.StatusUnauthorized,
"hasn't been activated": http.StatusForbidden,
"this node": http.StatusNotAcceptable,
} {
if strings.Contains(errStr, keyword) {
statusCode = status
@ -85,7 +87,7 @@ func MakeErrorHandler(err error) http.HandlerFunc {
}
WriteJSON(w, statusCode, response)
} else {
http.Error(w, err.Error(), statusCode)
http.Error(w, grpc.ErrorDesc(err), statusCode)
}
}
}