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 Jan 8, 2025
1 parent 2193ff4 commit 70826d4
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 @@ -565,6 +565,13 @@ func (f *Frontend) ArmResourceCreateOrUpdate(writer http.ResponseWriter, request
if updated {
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 {
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 @@ -250,6 +250,13 @@ func (f *Frontend) CreateOrUpdateNodePool(writer http.ResponseWriter, request *h
if updated {
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 {
logger.Error(err.Error())
arm.WriteInternalServerError(writer)
return
}
}

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

0 comments on commit 70826d4

Please sign in to comment.