@@ -199,7 +199,9 @@ func runRegister(ctx context.Context, t *terminal.Terminal, s RegisterStore, nam
199199
200200 t .Vprint (t .Green (" Registration complete." ))
201201
202- runSetup (node , t , deps )
202+ if err := runSetup (node , deps ); err != nil {
203+ return fmt .Errorf ("registration failed: %w" , err )
204+ }
203205
204206 if deps .prompter .ConfirmYesNo ("Would you like to enable SSH access to this device?" ) {
205207 if err := grantSSHAccess (ctx , t , deps , s , reg , brevUser , osUser ); err != nil {
@@ -304,19 +306,17 @@ func netbirdManagementConnected(statusOutput string) bool {
304306 return false
305307}
306308
307- func runSetup (node * nodev1.ExternalNode , t * terminal. Terminal , deps registerDeps ) {
309+ func runSetup (node * nodev1.ExternalNode , deps registerDeps ) error {
308310 ci := node .GetConnectivityInfo ()
309311 if ci == nil || ci .GetRegistrationCommand () == "" {
310- t .Vprintf (" %s\n " , t .Yellow ("Warning: Brev tunnel setup failed, please try again." ))
311- } else {
312- if err := deps .setupRunner .RunSetup (ci .GetRegistrationCommand ()); err != nil {
313- t .Vprintf (" Warning: setup command failed: %v\n " , err )
314- } else {
315- // netbird up reconfigures network routes; give them a moment
316- // to settle before making further RPC calls.
317- time .Sleep (2 * time .Second )
318- }
312+ return fmt .Errorf ("brev tunnel setup failed, please try again" )
319313 }
314+
315+ err := deps .setupRunner .RunSetup (ci .GetRegistrationCommand ())
316+ if err != nil {
317+ return fmt .Errorf ("setup command failed: %w" , err )
318+ }
319+ return nil
320320}
321321
322322func grantSSHAccess (ctx context.Context , t * terminal.Terminal , deps registerDeps , tokenProvider externalnode.TokenProvider , reg * DeviceRegistration , brevUser * entity.User , osUser * user.User ) error {
0 commit comments