Skip to content

Commit

Permalink
Fix errors introduced by merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kradalby committed May 31, 2022
1 parent 0676aa1 commit a19af04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,15 +420,15 @@ 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)
}

return nil
}

// 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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion poll.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, ":(")
Expand Down

0 comments on commit a19af04

Please sign in to comment.