From f59459f936f0dcb1529153cfe9e7f885c4acd200 Mon Sep 17 00:00:00 2001 From: Chao Geng <93526589+chaogeng77977@users.noreply.github.com> Date: Fri, 1 Apr 2022 14:40:44 +0800 Subject: [PATCH] EE-2463 When add agent to k8s with AGENT_SECRET, AGENT_SECRET should be configured on both side. otherwise, it will get unknown error. this error should be "agent already paired with another Portainer instance" (#6679) --- api/http/handler/endpoints/endpoint_create.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/http/handler/endpoints/endpoint_create.go b/api/http/handler/endpoints/endpoint_create.go index c80369489..7a2a08827 100644 --- a/api/http/handler/endpoints/endpoint_create.go +++ b/api/http/handler/endpoints/endpoint_create.go @@ -470,7 +470,7 @@ func (handler *Handler) createTLSSecuredEndpoint(payload *endpointCreatePayload, func (handler *Handler) snapshotAndPersistEndpoint(endpoint *portainer.Endpoint) *httperror.HandlerError { err := handler.SnapshotService.SnapshotEndpoint(endpoint) if err != nil { - if strings.Contains(err.Error(), "Invalid request signature") { + if strings.Contains(err.Error(), "Invalid request signature") || strings.Contains(err.Error(), "unknown") { err = errors.New("agent already paired with another Portainer instance") } return &httperror.HandlerError{http.StatusInternalServerError, "Unable to initiate communications with environment", err}