mirror of https://github.com/portainer/portainer
fix(tags): add missing error handling EE-4622 (#8102)
parent
e26a607d28
commit
9dfac98a26
|
@ -91,11 +91,9 @@ func (service *Service) UpdateTagFunc(ID portainer.TagID, updateFunc func(tag *p
|
|||
id := service.connection.ConvertToKey(int(ID))
|
||||
tag := &portainer.Tag{}
|
||||
|
||||
service.connection.UpdateObjectFunc(BucketName, id, tag, func() {
|
||||
return service.connection.UpdateObjectFunc(BucketName, id, tag, func() {
|
||||
updateFunc(tag)
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteTag deletes a tag.
|
||||
|
|
|
@ -91,7 +91,7 @@ func (handler *Handler) endpointGroupCreate(w http.ResponseWriter, r *http.Reque
|
|||
}
|
||||
|
||||
for _, tagID := range endpointGroup.TagIDs {
|
||||
handler.DataStore.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) {
|
||||
err = handler.DataStore.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) {
|
||||
tag.EndpointGroups[endpointGroup.ID] = true
|
||||
})
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ func (handler *Handler) endpointGroupDelete(w http.ResponseWriter, r *http.Reque
|
|||
}
|
||||
|
||||
for _, tagID := range endpointGroup.TagIDs {
|
||||
handler.DataStore.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) {
|
||||
err = handler.DataStore.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) {
|
||||
delete(tag.EndpointGroups, endpointGroup.ID)
|
||||
})
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ func (handler *Handler) endpointGroupUpdate(w http.ResponseWriter, r *http.Reque
|
|||
removeTags := tag.Difference(endpointGroupTagSet, payloadTagSet)
|
||||
|
||||
for tagID := range removeTags {
|
||||
handler.DataStore.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) {
|
||||
err = handler.DataStore.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) {
|
||||
delete(tag.EndpointGroups, endpointGroup.ID)
|
||||
})
|
||||
|
||||
|
@ -94,7 +94,7 @@ func (handler *Handler) endpointGroupUpdate(w http.ResponseWriter, r *http.Reque
|
|||
|
||||
endpointGroup.TagIDs = payload.TagIDs
|
||||
for _, tagID := range payload.TagIDs {
|
||||
handler.DataStore.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) {
|
||||
err = handler.DataStore.Tag().UpdateTagFunc(tagID, func(tag *portainer.Tag) {
|
||||
tag.EndpointGroups[endpointGroup.ID] = true
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue