Ignore pending DDM profiles when waiting to release a device (#18159)

#18160 

# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
- [x] Manual QA for all new/changed functionality
This commit is contained in:
Martin Angers
2024-04-09 17:12:51 -05:00
committed by GitHub
parent 3ca567f467
commit f4d6136236
2 changed files with 9 additions and 0 deletions
@@ -0,0 +1 @@
* Fixed an issue with automatic release of the device after setup when a DDM profile is pending.
+8
View File
@@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"strings"
"time"
"github.com/fleetdm/fleet/v4/server/contexts/ctxerr"
@@ -238,6 +239,13 @@ func (a *AppleMDM) runPostDEPReleaseDevice(ctx context.Context, args appleMDMArg
return ctxerr.Wrap(ctx, err, "failed to get host MDM profiles")
}
for _, prof := range profs {
// NOTE: DDM profiles (declarations) are ignored because while a device is
// awaiting to be released, it cannot process a DDM session (at least
// that's what we noticed during testing).
if strings.HasPrefix(prof.ProfileUUID, fleet.MDMAppleDeclarationUUIDPrefix) {
continue
}
// if it has any pending profiles, then its profiles are not done being
// delivered (installed or removed).
if prof.Status == nil || *prof.Status == fleet.MDMDeliveryPending {