From 96b4d2f391943ef6a5659e28a3fa68e53adb2644 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Sat, 17 Jul 2021 11:12:24 +0200 Subject: [PATCH] Mark the machine as unregistered before soft delete --- machine.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/machine.go b/machine.go index 9dc9be95..6f88e8d5 100644 --- a/machine.go +++ b/machine.go @@ -199,6 +199,8 @@ func (h *Headscale) GetMachineByID(id uint64) (*Machine, error) { // DeleteMachine softs deletes a Machine from the database func (h *Headscale) DeleteMachine(m *Machine) error { + m.Registered = false + h.db.Save(&m) // we mark it as unregistered, just in case if err := h.db.Delete(&m).Error; err != nil { return err }