From a19af0458286a4f18bcd0d33d797d19e4c0a6853 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Tue, 31 May 2022 11:03:08 +0200 Subject: [PATCH] Fix errors introduced by merge --- machine.go | 9 ++++++--- poll.go | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/machine.go b/machine.go index de3ac731..c2276459 100644 --- a/machine.go +++ b/machine.go @@ -420,7 +420,7 @@ func (h *Headscale) RenameMachine(machine *Machine, newName string) error { h.setLastStateChangeToNow(machine.Namespace.Name) - if err := h.db.Save(machine).Error; err != nil { + if err := h.db.Save(machine).Error; err != nil { return fmt.Errorf("failed to rename machine in the database: %w", err) } @@ -428,7 +428,7 @@ func (h *Headscale) RenameMachine(machine *Machine, newName string) error { } // RefreshMachine takes a Machine struct and sets the expire field to now. -func (h *Headscale) RefreshMachine(machine *Machine, expiry time.Time) { +func (h *Headscale) RefreshMachine(machine *Machine, expiry time.Time) error { now := time.Now() machine.LastSuccessfulUpdate = &now @@ -437,7 +437,10 @@ func (h *Headscale) RefreshMachine(machine *Machine, expiry time.Time) { h.setLastStateChangeToNow(machine.Namespace.Name) if err := h.db.Save(machine).Error; err != nil { - return fmt.Errorf("failed to refresh machine (update expiration) in the database: %w", err) + return fmt.Errorf( + "failed to refresh machine (update expiration) in the database: %w", + err, + ) } return nil diff --git a/poll.go b/poll.go index f85f9265..239f260b 100644 --- a/poll.go +++ b/poll.go @@ -121,7 +121,7 @@ func (h *Headscale) PollNetMapHandler(ctx *gin.Context) { log.Error(). Str("handler", "PollNetMap"). Str("id", ctx.Param("id")). - Str("machine", machine.Name). + Str("machine", machine.Hostname). Err(err). Msg("Failed to persist/update machine in the database") ctx.String(http.StatusInternalServerError, ":(")