mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-02 03:33:05 +00:00
Mark the machine as unregistered before soft delete
This commit is contained in:
parent
0f649aae8b
commit
96b4d2f391
1 changed files with 2 additions and 0 deletions
|
@ -199,6 +199,8 @@ func (h *Headscale) GetMachineByID(id uint64) (*Machine, error) {
|
||||||
|
|
||||||
// DeleteMachine softs deletes a Machine from the database
|
// DeleteMachine softs deletes a Machine from the database
|
||||||
func (h *Headscale) DeleteMachine(m *Machine) error {
|
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 {
|
if err := h.db.Delete(&m).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue