mirror of
https://github.com/portainer/portainer.git
synced 2025-07-28 09:49:40 +02:00
fix(edgegroup): failed to associate env to static edge group [BE-11599] (#374)
This commit is contained in:
parent
c93b2fedb4
commit
a43bb23bef
1 changed files with 6 additions and 1 deletions
|
@ -167,7 +167,7 @@ func (handler *Handler) edgeGroupUpdate(w http.ResponseWriter, r *http.Request)
|
||||||
|
|
||||||
func (handler *Handler) updateEndpointStacks(tx dataservices.DataStoreTx, endpoint *portainer.Endpoint, edgeGroups []portainer.EdgeGroup, edgeStacks []portainer.EdgeStack) error {
|
func (handler *Handler) updateEndpointStacks(tx dataservices.DataStoreTx, endpoint *portainer.Endpoint, edgeGroups []portainer.EdgeGroup, edgeStacks []portainer.EdgeStack) error {
|
||||||
relation, err := tx.EndpointRelation().EndpointRelation(endpoint.ID)
|
relation, err := tx.EndpointRelation().EndpointRelation(endpoint.ID)
|
||||||
if err != nil {
|
if err != nil && !handler.DataStore.IsErrObjectNotFound(err) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,6 +183,11 @@ func (handler *Handler) updateEndpointStacks(tx dataservices.DataStoreTx, endpoi
|
||||||
edgeStackSet[edgeStackID] = true
|
edgeStackSet[edgeStackID] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if relation == nil {
|
||||||
|
relation = &portainer.EndpointRelation{
|
||||||
|
EndpointID: endpoint.ID,
|
||||||
|
}
|
||||||
|
}
|
||||||
relation.EdgeStacks = edgeStackSet
|
relation.EdgeStacks = edgeStackSet
|
||||||
|
|
||||||
return tx.EndpointRelation().UpdateEndpointRelation(endpoint.ID, relation)
|
return tx.EndpointRelation().UpdateEndpointRelation(endpoint.ID, relation)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue