Compare commits

...

2 Commits

Author SHA1 Message Date
andres-portainer
5a37d6d848 Clean up the code. 2022-02-10 14:36:17 -03:00
andres-portainer
8667759e5b fix(edge-stacks): update the edge stacks status when removing a tag EE-2432 2022-02-10 14:35:46 -03:00

View File

@@ -175,15 +175,11 @@ func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *
}
if payload.Status != nil {
switch *payload.Status {
case 1:
switch portainer.EndpointStatus(*payload.Status) {
case portainer.EndpointStatusUp:
endpoint.Status = portainer.EndpointStatusUp
break
case 2:
case portainer.EndpointStatusDown:
endpoint.Status = portainer.EndpointStatusDown
break
default:
break
}
}
@@ -309,6 +305,13 @@ func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *
edgeStackSet[edgeStackID] = true
}
for _, stack := range edgeStacks {
if !edgeStackSet[stack.ID] {
delete(stack.Status, endpoint.ID)
handler.DataStore.EdgeStack().UpdateEdgeStack(stack.ID, &stack)
}
}
relation.EdgeStacks = edgeStackSet
err = handler.DataStore.EndpointRelation().UpdateEndpointRelation(endpoint.ID, relation)