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 1c24008
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 {
logger.Error(err.Error())

Check failure on line 519 in frontend/pkg/frontend/frontend.go

View workflow job for this annotation

GitHub Actions / lint

undefined: logger

Check failure on line 519 in frontend/pkg/frontend/frontend.go

View workflow job for this annotation

GitHub Actions / lint

undefined: logger

Check failure on line 519 in frontend/pkg/frontend/frontend.go

View workflow job for this annotation

GitHub Actions / lint

undefined: logger

Check failure on line 519 in frontend/pkg/frontend/frontend.go

View workflow job for this annotation

GitHub Actions / test

undefined: logger
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 {
logger.Error(err.Error())

Check failure on line 248 in frontend/pkg/frontend/node_pool.go

View workflow job for this annotation

GitHub Actions / lint

undefined: logger) (typecheck)

Check failure on line 248 in frontend/pkg/frontend/node_pool.go

View workflow job for this annotation

GitHub Actions / lint

undefined: logger) (typecheck)

Check failure on line 248 in frontend/pkg/frontend/node_pool.go

View workflow job for this annotation

GitHub Actions / lint

undefined: logger (typecheck)

Check failure on line 248 in frontend/pkg/frontend/node_pool.go

View workflow job for this annotation

GitHub Actions / test

undefined: logger
arm.WriteInternalServerError(writer)
return
}
}

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

0 comments on commit 1c24008

Please sign in to comment.