Delete ephemeral machines on logout

Update changelog

Use dedicated method to delete
This commit is contained in:
Juan Font 2022-12-27 11:33:51 +00:00
parent 4de49f5f49
commit afae1ff7b6
2 changed files with 15 additions and 0 deletions

View file

@ -622,6 +622,20 @@ func (h *Headscale) handleMachineLogOutCommon(
Caller().
Err(err).
Msg("Failed to write response")
return
}
if machine.isEphemeral() {
err = h.HardDeleteMachine(&machine)
if err != nil {
log.Error().
Err(err).
Str("machine", machine.Hostname).
Msg("Cannot delete ephemeral machine from the database")
}
return
}
log.Info().