From d140a57355b6b3054f50ebb6f9038bb8ab3f82bd Mon Sep 17 00:00:00 2001 From: gillespi314 <73313222+gillespi314@users.noreply.github.com> Date: Fri, 18 Aug 2023 10:34:13 -0500 Subject: [PATCH] Allow failed profiles to become verified if subsequently reported by osquery (#13343) --- server/datastore/mysql/apple_mdm.go | 4 ++-- server/datastore/mysql/apple_mdm_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/datastore/mysql/apple_mdm.go b/server/datastore/mysql/apple_mdm.go index 9f6a4843f3..fef4a08229 100644 --- a/server/datastore/mysql/apple_mdm.go +++ b/server/datastore/mysql/apple_mdm.go @@ -1661,14 +1661,14 @@ SET status = ? WHERE host_uuid = ? - AND status = ? + AND status IN(?) AND operation_type = ? AND profile_identifier IN(?)` args := []interface{}{ fleet.MDMAppleDeliveryVerified, host.UUID, - fleet.MDMAppleDeliveryVerifying, + []interface{}{fleet.MDMAppleDeliveryVerifying, fleet.MDMAppleDeliveryFailed}, fleet.MDMAppleOperationTypeInstall, identifiers, } diff --git a/server/datastore/mysql/apple_mdm_test.go b/server/datastore/mysql/apple_mdm_test.go index 25f19ef085..52e0b2fe28 100644 --- a/server/datastore/mysql/apple_mdm_test.go +++ b/server/datastore/mysql/apple_mdm_test.go @@ -4838,7 +4838,7 @@ func TestMDMProfileVerification(t *testing.T) { { name: "FailedThenFoundExpected", initialStatus: fleet.MDMAppleDeliveryFailed, - expectedStatus: fleet.MDMAppleDeliveryFailed, // no change + expectedStatus: fleet.MDMAppleDeliveryVerified, // failed can become verified if found later expectedDetail: "", }, } @@ -4901,7 +4901,7 @@ func TestMDMProfileVerification(t *testing.T) { { name: "FailedThenFoundExpectedAndUnexpected", initialStatus: fleet.MDMAppleDeliveryFailed, - expectedStatus: fleet.MDMAppleDeliveryFailed, // no change + expectedStatus: fleet.MDMAppleDeliveryVerified, // failed can become verified if found later expectedDetail: "", }, }