@@ -192,24 +192,25 @@ func runRegister(ctx context.Context, t *terminal.Terminal, s RegisterStore, opt
192192 return err
193193 }
194194
195- // Confirm the registration, interactive mode only
195+ t .Vprint ("" )
196+ t .Vprint (t .White ("══════════════════════════════════════════════════" ))
197+ t .Vprint (t .White (" Registering your device with Brev" ))
198+ t .Vprint (t .White ("══════════════════════════════════════════════════" ))
199+ t .Vprint ("" )
196200 if opts .interactive {
197- t .Vprint ("" )
198- t .Vprint (t .White ("══════════════════════════════════════════════════" ))
199- t .Vprint (t .White (" Registering your device with Brev" ))
200- t .Vprint (t .White ("══════════════════════════════════════════════════" ))
201- t .Vprint ("" )
202201 t .Vprint (t .Green (" Please confirm before continuing:" ))
203202 t .Vprint ("" )
204- t .Vprintf (" %s %s\n " , t .Green (fmt .Sprintf ("%-14s" , "Device:" )), t .BoldBlue (name ))
205- t .Vprintf (" %s %s\n " , t .Green (fmt .Sprintf ("%-14s" , "Organization:" )), t .BoldBlue (org .Name + " (" + org .ID + ")" ))
206- t .Vprint ("" )
207- t .Vprint (t .Yellow (" This will:" ))
208- t .Vprint (" 1. Set up Brev tunnel" )
209- t .Vprint (" 2. Collect hardware profile" )
210- t .Vprint (" 3. Register this machine with Brev" )
211- t .Vprint ("" )
203+ }
204+ t .Vprintf (" %s %s\n " , t .Green (fmt .Sprintf ("%-14s" , "Device:" )), t .BoldBlue (name ))
205+ t .Vprintf (" %s %s\n " , t .Green (fmt .Sprintf ("%-14s" , "Organization:" )), t .BoldBlue (org .Name + " (" + org .ID + ")" ))
206+ t .Vprint ("" )
207+ t .Vprint (t .Yellow (" This will:" ))
208+ t .Vprint (" 1. Set up Brev tunnel" )
209+ t .Vprint (" 2. Collect hardware profile" )
210+ t .Vprint (" 3. Register this machine with Brev" )
211+ t .Vprint ("" )
212212
213+ if opts .interactive {
213214 if ! deps .prompter .ConfirmYesNo ("Proceed with registration?" ) {
214215 t .Vprint ("Registration canceled." )
215216 return nil
@@ -243,7 +244,7 @@ func runRegister(ctx context.Context, t *terminal.Terminal, s RegisterStore, opt
243244 if err != nil {
244245 return fmt .Errorf ("failed to determine current Linux user: %w" , err )
245246 }
246- if err := grantSSHAccessWithPort (ctx , t , deps , s , reg , brevUser , osUser , sshPortForGrant ); err != nil {
247+ if err := grantSSHAccessWithPort (ctx , t , deps , s , reg , brevUser , osUser , sshPortForGrant , opts . interactive ); err != nil {
247248 t .Vprintf (" Warning: SSH access not granted: %v\n " , err )
248249 }
249250 }
@@ -448,7 +449,7 @@ func runSetup(node *nodev1.ExternalNode, t *terminal.Terminal, deps registerDeps
448449}
449450
450451// grantSSHAccessWithPort enables SSH: shows confirm table, uses port or prompts if port is 0, then allocates port and grants access.
451- func grantSSHAccessWithPort (ctx context.Context , t * terminal.Terminal , deps registerDeps , tokenProvider externalnode.TokenProvider , reg * DeviceRegistration , brevUser * entity.User , osUser * user.User , port int32 ) error {
452+ func grantSSHAccessWithPort (ctx context.Context , t * terminal.Terminal , deps registerDeps , tokenProvider externalnode.TokenProvider , reg * DeviceRegistration , brevUser * entity.User , osUser * user.User , port int32 , interactive bool ) error {
452453 brevUserName := brevUser .Username
453454 if brevUserName == "" {
454455 brevUserName = brevUser .Email
@@ -462,8 +463,10 @@ func grantSSHAccessWithPort(ctx context.Context, t *terminal.Terminal, deps regi
462463 t .Vprint (t .White (" Enabling SSH access on this device" ))
463464 t .Vprint (t .White ("══════════════════════════════════════════════════" ))
464465 t .Vprint ("" )
465- t .Vprint (t .Green (" Please confirm before continuing:" ))
466- t .Vprint ("" )
466+ if interactive {
467+ t .Vprint (t .Green (" Please confirm before continuing:" ))
468+ t .Vprint ("" )
469+ }
467470 t .Vprintf (" %s %s\n " , t .Green (fmt .Sprintf ("%-14s" , "Device:" )), t .BoldBlue (reg .DisplayName + " (" + reg .ExternalNodeID + ")" ))
468471 t .Vprintf (" %s %s\n " , t .Green (fmt .Sprintf ("%-14s" , "Organization:" )), t .BoldBlue (reg .OrgName + " (" + reg .OrgID + ")" ))
469472 t .Vprintf (" %s %s\n " , t .Green (fmt .Sprintf ("%-14s" , "Brev user:" )), t .BoldBlue (brevUserName + " (" + brevUser .ID + ")" ))
0 commit comments