1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 15:29:42 +02:00

fix(edgestack): incorrect response code (#8873)

This commit is contained in:
Oscar Zhou 2023-05-04 10:01:33 +12:00 committed by GitHub
parent 19eceaf37f
commit ed279ba65b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 28 deletions

View file

@ -8,6 +8,8 @@ import (
"github.com/portainer/portainer/api/dataservices"
)
var ErrEdgeGroupNotFound = errors.New("Edge group was not found")
// EdgeStackRelatedEndpoints returns a list of environments(endpoints) related to this Edge stack
func EdgeStackRelatedEndpoints(edgeGroupIDs []portainer.EdgeGroupID, endpoints []portainer.Endpoint, endpointGroups []portainer.EndpointGroup, edgeGroups []portainer.EdgeGroup) ([]portainer.EndpointID, error) {
edgeStackEndpoints := []portainer.EndpointID{}
@ -23,7 +25,7 @@ func EdgeStackRelatedEndpoints(edgeGroupIDs []portainer.EdgeGroupID, endpoints [
}
if edgeGroup == nil {
return nil, errors.New("Edge group was not found")
return nil, ErrEdgeGroupNotFound
}
edgeStackEndpoints = append(edgeStackEndpoints, EdgeGroupRelatedEndpoints(edgeGroup, endpoints, endpointGroups)...)