Skip to content

Commit

Permalink
frontend: Refetch resource document after updating
Browse files Browse the repository at this point in the history
Noticed while testing Tags field patching that the PATCH response
did not contain the updated Tags. I had to GET the resource again
to see the correct set of Tags.
  • Loading branch information
Matthew Barnes committed Dec 13, 2024
1 parent 8d3c113 commit 8716a16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frontend/pkg/frontend/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,13 @@ func (f *Frontend) ArmResourceCreateOrUpdate(writer http.ResponseWriter, request
if updated {
f.logger.Info(fmt.Sprintf("document updated for %s", resourceID))
}
// Get the updated resource document for the response.
doc, err = f.dbClient.GetResourceDoc(ctx, resourceID)
if err != nil {
f.logger.Error(err.Error())
arm.WriteInternalServerError(writer)
return
}
}

responseBody, err := marshalCSCluster(csCluster, doc, versionedInterface)
Expand Down
7 changes: 7 additions & 0 deletions frontend/pkg/frontend/node_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,13 @@ func (f *Frontend) CreateOrUpdateNodePool(writer http.ResponseWriter, request *h
if updated {
f.logger.Info(fmt.Sprintf("document updated for %s", resourceID))
}
// Get the updated resource document for the response.
doc, err = f.dbClient.GetResourceDoc(ctx, resourceID)
if err != nil {
f.logger.Error(err.Error())
arm.WriteInternalServerError(writer)
return
}
}

responseBody, err := marshalCSNodePool(csNodePool, doc, versionedInterface)
Expand Down

0 comments on commit 8716a16

Please sign in to comment.