mirror of https://github.com/portainer/portainer
fix(edge): fix status inspect error message EE-5190 (#8661)
parent
40c387f4f4
commit
347f66b1f1
|
@ -81,16 +81,14 @@ func (handler *Handler) endpointEdgeStatusInspect(w http.ResponseWriter, r *http
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := handler.DataStore.Endpoint().Heartbeat(portainer.EndpointID(endpointID)); !ok {
|
if _, ok := handler.DataStore.Endpoint().Heartbeat(portainer.EndpointID(endpointID)); !ok {
|
||||||
return httperror.NotFound("Unable to find an environment with the specified identifier inside the database", nil)
|
// EE-5910
|
||||||
|
return httperror.Forbidden("Permission denied to access environment", errors.New("the device has not been trusted yet"))
|
||||||
}
|
}
|
||||||
|
|
||||||
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
|
endpoint, err := handler.DataStore.Endpoint().Endpoint(portainer.EndpointID(endpointID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if handler.DataStore.IsErrObjectNotFound(err) {
|
// EE-5910
|
||||||
return httperror.NotFound("Unable to find an environment with the specified identifier inside the database", err)
|
return httperror.Forbidden("Permission denied to access environment", errors.New("the device has not been trusted yet"))
|
||||||
}
|
|
||||||
|
|
||||||
return httperror.InternalServerError("Unable to find an environment with the specified identifier inside the database", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = handler.requestBouncer.AuthorizedEdgeEndpointOperation(r, endpoint)
|
err = handler.requestBouncer.AuthorizedEdgeEndpointOperation(r, endpoint)
|
||||||
|
|
|
@ -30,7 +30,7 @@ var endpointTestCases = []endpointTestCase{
|
||||||
{
|
{
|
||||||
portainer.Endpoint{},
|
portainer.Endpoint{},
|
||||||
portainer.EndpointRelation{},
|
portainer.EndpointRelation{},
|
||||||
http.StatusNotFound,
|
http.StatusForbidden,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
portainer.Endpoint{
|
portainer.Endpoint{
|
||||||
|
@ -43,7 +43,7 @@ var endpointTestCases = []endpointTestCase{
|
||||||
portainer.EndpointRelation{
|
portainer.EndpointRelation{
|
||||||
EndpointID: -1,
|
EndpointID: -1,
|
||||||
},
|
},
|
||||||
http.StatusNotFound,
|
http.StatusForbidden,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
portainer.Endpoint{
|
portainer.Endpoint{
|
||||||
|
|
Loading…
Reference in New Issue