mirror of https://github.com/portainer/portainer
fix(api/snapshot): convert error message only on matching env types (#7661)
parent
8ef584e41c
commit
6063f368ea
|
@ -495,7 +495,8 @@ func (handler *Handler) createTLSSecuredEndpoint(payload *endpointCreatePayload,
|
||||||
func (handler *Handler) snapshotAndPersistEndpoint(endpoint *portainer.Endpoint) *httperror.HandlerError {
|
func (handler *Handler) snapshotAndPersistEndpoint(endpoint *portainer.Endpoint) *httperror.HandlerError {
|
||||||
err := handler.SnapshotService.SnapshotEndpoint(endpoint)
|
err := handler.SnapshotService.SnapshotEndpoint(endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), "Invalid request signature") || strings.Contains(err.Error(), "unknown") {
|
if (endpoint.Type == portainer.AgentOnDockerEnvironment && strings.Contains(err.Error(), "Invalid request signature")) ||
|
||||||
|
(endpoint.Type == portainer.AgentOnKubernetesEnvironment && strings.Contains(err.Error(), "unknown")) {
|
||||||
err = errors.New("agent already paired with another Portainer instance")
|
err = errors.New("agent already paired with another Portainer instance")
|
||||||
}
|
}
|
||||||
return httperror.InternalServerError("Unable to initiate communications with environment", err)
|
return httperror.InternalServerError("Unable to initiate communications with environment", err)
|
||||||
|
|
Loading…
Reference in New Issue