Implement ExpireMachine rpc

This commit is contained in:
Kristoffer Dalby 2021-11-21 13:40:19 +00:00
parent f1c05f8010
commit bd1d1b1a3b
3 changed files with 64 additions and 0 deletions

View file

@ -262,6 +262,14 @@ func (h *Headscale) UpdateMachine(machine *Machine) error {
return nil
}
// ExpireMachine takes a Machine struct and sets the expire field to now.
func (h *Headscale) ExpireMachine(machine *Machine) {
now := time.Now()
machine.Expiry = &now
h.db.Save(machine)
}
// DeleteMachine softs deletes a Machine from the database.
func (h *Headscale) DeleteMachine(machine *Machine) error {
err := h.RemoveSharedMachineFromAllNamespaces(machine)