From 62808cbd86599008acbf66101a46c2c7c11febfa Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Sun, 24 Apr 2022 20:56:28 +0100 Subject: [PATCH] Bubble error up to user for rename --- grpcv1.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/grpcv1.go b/grpcv1.go index 68303bea..36c9ad16 100644 --- a/grpcv1.go +++ b/grpcv1.go @@ -215,7 +215,7 @@ func (api headscaleV1APIServer) ExpireMachine( ) log.Trace(). - Str("machine", machine.Name). + Str("machine", machine.Hostname). Time("expiry", *machine.Expiry). Msg("machine expired") @@ -231,13 +231,16 @@ func (api headscaleV1APIServer) RenameMachine( return nil, err } - api.h.RenameMachine( + err = api.h.RenameMachine( machine, request.GetNewName(), ) + if err != nil { + return nil, err + } log.Trace(). - Str("machine", machine.Name). + Str("machine", machine.Hostname). Time("expiry", *machine.Expiry). Msg("machine expired") @@ -393,7 +396,7 @@ func (api headscaleV1APIServer) DebugCreateMachine( newMachine := Machine{ MachineKey: request.GetKey(), - Name: request.GetName(), + Hostname: request.GetName(), Namespace: *namespace, Expiry: &time.Time{},