mirror of https://github.com/portainer/portainer
fix(edgestacks): reorder operations to properly update the endpoint relations BE-11233 (#12239)
parent
80f53ed6ec
commit
cee997e0b3
|
@ -101,14 +101,14 @@ func (service *Service) PersistEdgeStack(
|
||||||
stack.EntryPoint = composePath
|
stack.EntryPoint = composePath
|
||||||
stack.NumDeployments = len(relatedEndpointIds)
|
stack.NumDeployments = len(relatedEndpointIds)
|
||||||
|
|
||||||
if err := service.updateEndpointRelations(tx, stack.ID, relatedEndpointIds); err != nil {
|
|
||||||
return nil, fmt.Errorf("unable to update endpoint relations: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := tx.EdgeStack().Create(stack.ID, stack); err != nil {
|
if err := tx.EdgeStack().Create(stack.ID, stack); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := service.updateEndpointRelations(tx, stack.ID, relatedEndpointIds); err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to update endpoint relations: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
return stack, nil
|
return stack, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue