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

@ -11,6 +11,7 @@
- Report if a machine is online in CLI more accurately [#1062](https://github.com/juanfont/headscale/pull/1062) - Report if a machine is online in CLI more accurately [#1062](https://github.com/juanfont/headscale/pull/1062)
- Added config option for custom DNS records [#1035](https://github.com/juanfont/headscale/pull/1035) - Added config option for custom DNS records [#1035](https://github.com/juanfont/headscale/pull/1035)
- Expire nodes based on OIDC token expiry [#1067](https://github.com/juanfont/headscale/pull/1067) - Expire nodes based on OIDC token expiry [#1067](https://github.com/juanfont/headscale/pull/1067)
- Remote ephemeral nodes on logout [#1098](https://github.com/juanfont/headscale/pull/1098)
## 0.17.1 (2022-12-05) ## 0.17.1 (2022-12-05)

View file

@ -622,6 +622,20 @@ func (h *Headscale) handleMachineLogOutCommon(
Caller(). Caller().
Err(err). Err(err).
Msg("Failed to write response") 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(). log.Info().