From 07505fabccbc8a73c77c875a9c9b4d54d4f8bc8d Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Fri, 20 Sep 2019 16:13:58 +1200 Subject: [PATCH] fix(api): remove automatic backend failure for Down endpoints (#3160) --- api/http/handler/endpointproxy/proxy_docker.go | 4 ---- app/portainer/views/home/homeController.js | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/api/http/handler/endpointproxy/proxy_docker.go b/api/http/handler/endpointproxy/proxy_docker.go index bdd5c8322..35490a8ff 100644 --- a/api/http/handler/endpointproxy/proxy_docker.go +++ b/api/http/handler/endpointproxy/proxy_docker.go @@ -25,10 +25,6 @@ func (handler *Handler) proxyRequestsToDockerAPI(w http.ResponseWriter, r *http. return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} } - if endpoint.Type != portainer.EdgeAgentEnvironment && endpoint.Status == portainer.EndpointStatusDown { - return &httperror.HandlerError{http.StatusServiceUnavailable, "Unable to query endpoint", errors.New("Endpoint is down")} - } - err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint, true) if err != nil { return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} diff --git a/app/portainer/views/home/homeController.js b/app/portainer/views/home/homeController.js index 93168ede0..643988c97 100644 --- a/app/portainer/views/home/homeController.js +++ b/app/portainer/views/home/homeController.js @@ -18,7 +18,8 @@ angular.module('portainer.app') } checkEndpointStatus(endpoint) - .then(function success() { + .then(function success(data) { + endpoint = data; return switchToDockerEndpoint(endpoint); }).catch(function error(err) { Notifications.error('Failure', err, 'Unable to verify endpoint status'); @@ -59,6 +60,7 @@ angular.module('portainer.app') EndpointService.updateEndpoint(endpoint.Id, { Status: status }) .then(function success() { + endpoint.Status = status; deferred.resolve(endpoint); }).catch(function error(err) { deferred.reject({ msg: 'Unable to update endpoint status', err: err });