log as error in apple reconciler for mixed label modes (#47502)
This commit is contained in:
@@ -280,6 +280,10 @@ func (ds *Datastore) listAppleProfilesForReconcileTransaction(ctx context.Contex
|
||||
|
||||
for uuid, ia := range includeModes {
|
||||
p := byUUID[uuid]
|
||||
if p == nil {
|
||||
// Should not happen, so not worth logging anything here.
|
||||
continue
|
||||
}
|
||||
if ia.mixed {
|
||||
// Defensive: include rows disagreed on require_all (should
|
||||
// be impossible in production — the upsert path enforces a
|
||||
@@ -287,7 +291,9 @@ func (ds *Datastore) listAppleProfilesForReconcileTransaction(ctx context.Contex
|
||||
// intent; exclude labels (if any) are preserved.
|
||||
p.IncludeLabels = nil
|
||||
p.IncludeMode = fleet.AppleProfileIncludeNone
|
||||
ds.logger.WarnContext(ctx, "apple profile has mixed include label modes; ignoring include labels", "profile_uuid", uuid, "team_id", p.TeamID)
|
||||
errMsg := "apple profile has mixed include label modes; ignoring include labels"
|
||||
ds.logger.ErrorContext(ctx, errMsg, "profile_uuid", uuid, "team_id", p.TeamID)
|
||||
ctxerr.Handle(ctx, ctxerr.New(ctx, errMsg))
|
||||
continue
|
||||
}
|
||||
p.IncludeMode = ia.mode
|
||||
@@ -581,11 +587,17 @@ func (ds *Datastore) listAppleDeclarationsForReconcileTransaction(ctx context.Co
|
||||
|
||||
for uuid, ia := range includeModes {
|
||||
d := byUUID[uuid]
|
||||
if d == nil {
|
||||
// Should never happen, so not worth logging anything here.
|
||||
continue
|
||||
}
|
||||
if ia.mixed {
|
||||
d.IncludeLabels = nil
|
||||
d.IncludeMode = fleet.AppleProfileIncludeNone
|
||||
|
||||
ds.logger.WarnContext(ctx, "apple declaration has mixed include label modes; ignoring include labels", "declaration_uuid", uuid, "team_id", d.TeamID)
|
||||
errMsg := "apple declaration has mixed include label modes; ignoring include labels"
|
||||
ds.logger.ErrorContext(ctx, errMsg, "declaration_uuid", uuid, "team_id", d.TeamID)
|
||||
ctxerr.Handle(ctx, ctxerr.New(ctx, errMsg))
|
||||
continue
|
||||
}
|
||||
d.IncludeMode = ia.mode
|
||||
|
||||
Reference in New Issue
Block a user