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

Disabling calendar policies removes scheduled calendar events #17882

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

lucasmrod
Copy link
Member

@lucasmrod lucasmrod commented Mar 27, 2024

#17230

Fix for the following scenarios:

  • Team has only one policy with calendar enabled. Events are created on user calendars. Then the user disables the calendar on such policy. Expected behavior: Events on the user calendar should be cleaned up in that scenario.
  • Policy platform is edited (which removes policy_membership entries) and we'd like to have the calendar event removed for the hosts that do not apply anymore.

To cover these scenarios I changed ds.GetTeamHostsPolicyMemberships so that it also returns hosts that have a calendar event AND have no results on policies (returned as passing=1).
E.g. this could happen if there ARE calendar events for a team but with a platform that doesn't match the host (so it has no results).

@lucasmrod lucasmrod requested a review from a team as a code owner March 27, 2024 12:51
Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 40.74074% with 16 lines in your changes are missing coverage. Please review.

Project coverage is 65.33%. Comparing base (9bb1610) to head (4e7626e).
Report is 6 commits behind head on main.

Files Patch % Lines
cmd/fleet/calendar_cron.go 5.88% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17882      +/-   ##
==========================================
- Coverage   65.33%   65.33%   -0.01%     
==========================================
  Files        1204     1204              
  Lines      110022   110034      +12     
  Branches     2585     2585              
==========================================
+ Hits        71883    71886       +3     
- Misses      32638    32646       +8     
- Partials     5501     5502       +1     
Flag Coverage Δ
backend 66.33% <40.74%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Member

@getvictor getvictor left a comment

Choose a reason for hiding this comment

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

LGTM

@lucasmrod lucasmrod merged commit ea92433 into main Mar 27, 2024
18 checks passed
@lucasmrod lucasmrod deleted the 17230-disabling-calendar-policies branch March 27, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants