correctly update machine namespace

This commit is contained in:
Igor Perepilitsyn 2022-05-02 13:47:21 +04:00
parent 1b3a7bbf03
commit 6ba68d150c
2 changed files with 6 additions and 2 deletions

View file

@ -177,8 +177,10 @@ func (h *Headscale) SetMachineNamespace(machine *Machine, namespaceName string)
if err != nil {
return err
}
machine.NamespaceID = namespace.ID
h.db.Save(&machine)
machine.Namespace = *namespace
if result := h.db.Save(&machine); result.Error != nil {
return result.Error
}
return nil
}