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

GH-853: Allow deleting branding resource even on free tenants #875

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

sergiught
Copy link
Contributor

🔧 Changes

This PR changes the logic within the delete func of the branding resource to allow free tier tenants to delete the resource as well. Free tier tenants won't have custom domains functionality enabled and at the moment we check if any are set on the tenant to be able to remove the universal login page template.

📚 References

🔬 Testing

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@sergiught sergiught requested a review from a team as a code owner November 9, 2023 10:49
if err := checkForCustomDomains(ctx, api); err != nil {
if err == errNoCustomDomain {
return nil
if err := checkForCustomDomains(ctx, api); err == nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now aligned with the read logic found here

if err := checkForCustomDomains(ctx, api); err == nil {
where we skip reading the universal login template body if no custom domains are set on the tenant or if the tenant is a free tier tenant.

}

if err := api.Branding.DeleteUniversalLogin(ctx); err != nil {
return diag.FromErr(err)
}

return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you're inverting the if/else, shouldn't you be returning err?

Copy link
Contributor Author

@sergiught sergiught Nov 9, 2023

Choose a reason for hiding this comment

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

If we get no error it means we're not a free tier tenant and we have the ability to delete the universal login template data, otherwise we can't, so we shouldn't return the error in that case but allow for a successful deletion of the resource.

Please also check above: #875 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Update: Ok with ignoring the errors for now because they would be unlikely and it is too difficult to identify the specific errors that we would want to keep or ignore. Especially provided that this is a deletion operation.

@sergiught sergiught merged commit c9968e0 into main Nov 9, 2023
6 checks passed
@sergiught sergiught deleted the GH-853-branding-destroy branch November 9, 2023 17:51
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.

3 participants