mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-05 17:05:51 +08:00
Prevent multiple device records with the same UDID (#422)
This commit is contained in:
committed by
Victor Vrantchan
parent
6507d2edd2
commit
4283b5a76e
@@ -218,7 +218,7 @@ func (db *DB) pollCheckin(pubsubSvc pubsub.PublishSubscriber) error {
|
||||
fmt.Println(err) // some other issue is going on
|
||||
continue
|
||||
}
|
||||
_, err = db.DeviceByUDID(ev.Command.UDID)
|
||||
byUDID, err := db.DeviceByUDID(ev.Command.UDID)
|
||||
if err != nil && isNotFound(err) { // never checked in
|
||||
fmt.Printf("checking in new device %s\n", ev.Command.SerialNumber)
|
||||
} else if err != nil {
|
||||
@@ -226,6 +226,7 @@ func (db *DB) pollCheckin(pubsubSvc pubsub.PublishSubscriber) error {
|
||||
continue
|
||||
} else if err == nil {
|
||||
fmt.Printf("re-enrolling device %s\n", ev.Command.SerialNumber)
|
||||
newDevice = byUDID
|
||||
newDevice.Enrolled = false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user