mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-02 03:33:05 +00:00
Cleanup some unreachable code
This commit is contained in:
parent
379017602c
commit
82cb6b9ddc
2 changed files with 1 additions and 24 deletions
23
machine.go
23
machine.go
|
@ -718,25 +718,6 @@ func (h *Headscale) RegisterMachine(machine Machine,
|
||||||
Str("machine_key", machine.MachineKey).
|
Str("machine_key", machine.MachineKey).
|
||||||
Msg("Registering machine")
|
Msg("Registering machine")
|
||||||
|
|
||||||
// If the machine is already in the database, it is seeking
|
|
||||||
// reauthentication, and by reaching this step, has been authenticated
|
|
||||||
// and need to have an updated expiry.
|
|
||||||
var machineKey key.MachinePublic
|
|
||||||
_ = machineKey.UnmarshalText(
|
|
||||||
[]byte(MachinePublicKeyEnsurePrefix(machine.MachineKey)),
|
|
||||||
)
|
|
||||||
machineFromDatabase, _ := h.GetMachineByMachineKey(machineKey)
|
|
||||||
if machineFromDatabase != nil {
|
|
||||||
log.Trace().
|
|
||||||
Caller().
|
|
||||||
Str("machine", machine.Name).
|
|
||||||
Msg("machine already registered, reauthenticating")
|
|
||||||
|
|
||||||
h.RefreshMachine(machineFromDatabase, *machine.Expiry)
|
|
||||||
|
|
||||||
return machineFromDatabase, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Trace().
|
log.Trace().
|
||||||
Caller().
|
Caller().
|
||||||
Str("machine", machine.Name).
|
Str("machine", machine.Name).
|
||||||
|
@ -758,10 +739,6 @@ func (h *Headscale) RegisterMachine(machine Machine,
|
||||||
|
|
||||||
machine.IPAddresses = ips
|
machine.IPAddresses = ips
|
||||||
|
|
||||||
// TODO(kradalby): This field is uneccessary metadata,
|
|
||||||
// move it to tags instead of having a column.
|
|
||||||
// machine.RegisterMethod = registrationMethod
|
|
||||||
|
|
||||||
h.db.Save(&machine)
|
h.db.Save(&machine)
|
||||||
|
|
||||||
log.Trace().
|
log.Trace().
|
||||||
|
|
2
oidc.go
2
oidc.go
|
@ -215,7 +215,7 @@ func (h *Headscale) OIDCCallback(ctx *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// retrieve machine information
|
// retrieve machine information if it exist
|
||||||
machine, err := h.GetMachineByMachineKey(machineKey)
|
machine, err := h.GetMachineByMachineKey(machineKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Msg("machine key not found in database")
|
log.Error().Msg("machine key not found in database")
|
||||||
|
|
Loading…
Reference in a new issue