Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly handle missing WebApps and document the custom resource interface better #3533

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

thomas11
Copy link
Contributor

Fixes #3526

The WebApp custom resource currently returns (notFound, error) when the requested app doesn't exist. Although undocumented, the downstream assumes that custom resources return (notFound, nil) in that case. I.e., it's the responsibility of the custom resource to distinguish between "not found" and other kinds of errors.

@thomas11 thomas11 requested review from danielrbradley and a team August 21, 2024 15:54
@thomas11 thomas11 self-assigned this Aug 21, 2024
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Copy link
Member

@danielrbradley danielrbradley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your changes make sense 👍

One question of the existing behaviour which might warrant a new issue to fix at another point.

@@ -52,7 +52,7 @@ func makeWebAppResource(resourceType, path string, crudClientFactory crud.Resour
// the WebApp does not return the SiteConfig. We need to make a separate GET request to
// /config/web and merge the results. #1468
Read: func(ctx context.Context, id string, inputs resource.PropertyMap) (map[string]any, bool, error) {
// We can reasanably assume that WebApp and WebAppSlot share their API version since they are almost identical.
// We assume that WebApp and WebAppSlot share their API version since they are almost identical.
apiVersion, ok := versionLookup.GetDefaultApiVersionForResource("Web", "WebApp")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A slight aside from your changes ... I think just fetching the default API version here might be incorrect. I think this code is called for explict versions of the WebApp resource too - at which point we should be fetching the version associated to the resource token that the user is using.

Copy link

codecov bot commented Aug 21, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 57.68%. Comparing base (8c7b1a5) to head (01f0623).
Report is 1 commits behind head on master.

Files Patch % Lines
provider/pkg/azure/azure.go 0.00% 4 Missing ⚠️
...der/pkg/resources/customresources/custom_webapp.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3533      +/-   ##
==========================================
- Coverage   57.72%   57.68%   -0.05%     
==========================================
  Files          66       66              
  Lines        8299     8305       +6     
==========================================
  Hits         4791     4791              
- Misses       3063     3069       +6     
  Partials      445      445              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thomas11 thomas11 force-pushed the tkappler/refresh-deleted-webapp branch from 2dd7a87 to 01f0623 Compare August 21, 2024 16:42
@thomas11 thomas11 enabled auto-merge (squash) August 21, 2024 16:43
@thomas11 thomas11 merged commit d60a23b into master Aug 21, 2024
23 checks passed
@thomas11 thomas11 deleted the tkappler/refresh-deleted-webapp branch August 21, 2024 17:17
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v2.57.1.

thomas11 added a commit that referenced this pull request Aug 22, 2024
…erface better (#3533)

Fixes #3526

The WebApp custom resource currently returns (notFound, error) when the
requested app doesn't exist. Although undocumented, the downstream
assumes that custom resources return (notFound, nil) in that case. I.e.,
it's the responsibility of the custom resource to distinguish between
"not found" and other kinds of errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pulumi refresh fail to handle resource deleted outside of pulumi management (manual delete)
3 participants