-
Notifications
You must be signed in to change notification settings - Fork 887
Policy automations don't unset on explicit null in PATCH #23490
Copy link
Copy link
Closed
Labels
#g-softwareSoftware product groupSoftware product group:releaseReady to write code. Scheduled in a release. See "Making changes" in handbook.Ready to write code. Scheduled in a release. See "Making changes" in handbook.bugSomething isn't working as documentedSomething isn't working as documented~backendBackend-related issue.Backend-related issue.~engineering-initiatedEngineering-initiated story, such as a bug, refactor, or contributor experience improvement.Engineering-initiated story, such as a bug, refactor, or contributor experience improvement.~released bugThis bug was found in a stable release.This bug was found in a stable release.
Milestone
Metadata
Metadata
Assignees
Labels
#g-softwareSoftware product groupSoftware product group:releaseReady to write code. Scheduled in a release. See "Making changes" in handbook.Ready to write code. Scheduled in a release. See "Making changes" in handbook.bugSomething isn't working as documentedSomething isn't working as documented~backendBackend-related issue.Backend-related issue.~engineering-initiatedEngineering-initiated story, such as a bug, refactor, or contributor experience improvement.Engineering-initiated story, such as a bug, refactor, or contributor experience improvement.~released bugThis bug was found in a stable release.This bug was found in a stable release.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Fleet version: >= 4.57.0
💥 Actual behavior
Right now zero'ing out policy automations for software installs and script runs requires setting an ID to zero rather than null, because the request unmarshalling code doesn't differentiate between an explicit null and an omitted field. While this behavior is documented, this doesn't match with general API user expectations on PATCHes.
🧑💻 Steps to reproduce
🛠️ To fix
Follow the JSON unmarshalling pattern referenced from the patterns document for both software install and script run policy automation parts of the policy PATCH request. Update docs to note that an explicit null will now clear the automation, and update the frontend to use this convention.
QA Notes
Need to regression test policy create/edit on Fleet Free to ensure we aren't locking users out of editing policies at all. I think we'll be fine since IIRC the frontend doesn't include software title/script IDs in the existing edit call at all (those API calls are handled via the separate automation dialog for now), but want to make 100% sure.