@@ -296,7 +296,10 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
296296 var wg sync.WaitGroup
297297
298298 wg .Add (1 )
299- go intervalCheckIsRuntimePersisted (15000 , ctx , opts .RuntimeName , & wg )
299+ err = intervalCheckIsRuntimePersisted (15000 , ctx , opts .RuntimeName , & wg )
300+ if err != nil {
301+ return fmt .Errorf ("failed to complete installation. Error: %w" , err )
302+ }
300303 wg .Wait ()
301304
302305 log .G (ctx ).Infof ("done installing runtime '%s'" , opts .RuntimeName )
@@ -372,12 +375,13 @@ func checkExistingRuntimes(ctx context.Context, runtime string) error {
372375 return nil
373376}
374377
375- func intervalCheckIsRuntimePersisted (milliseconds int , ctx context.Context , runtimeName string , wg * sync.WaitGroup ) {
378+ func intervalCheckIsRuntimePersisted (milliseconds int , ctx context.Context , runtimeName string , wg * sync.WaitGroup ) error {
376379 interval := time .Duration (milliseconds ) * time .Millisecond
377380 ticker := time .NewTicker (interval )
378381 var err error
379382
380383 for retries := 20 ; retries > 0 ; <- ticker .C {
384+ retries --
381385 fmt .Println ("waiting for the runtime installation to complete..." )
382386 var runtimes []model.Runtime
383387 runtimes , err = cfConfig .NewClient ().V2 ().Runtime ().List (ctx )
@@ -389,14 +393,13 @@ func intervalCheckIsRuntimePersisted(milliseconds int, ctx context.Context, runt
389393 if rt .Metadata .Name == runtimeName {
390394 wg .Done ()
391395 ticker .Stop ()
392- return
396+ return nil
393397 }
394398 }
395399
396- retries --
397400 }
398401
399- panic ( fmt .Errorf ("failed to complete the runtime installation due to error : %w" , err ) )
402+ return fmt .Errorf ("failed to complete the runtime installation due to timeout. Error : %w" , err )
400403}
401404
402405func NewRuntimeListCommand () * cobra.Command {
@@ -432,7 +435,7 @@ func RunRuntimeList(ctx context.Context) error {
432435 status := "N/A"
433436 namespace := "N/A"
434437 cluster := "N/A"
435- name := "N/A"
438+ name := rt . Metadata . Name
436439 version := "N/A"
437440
438441 if rt .Self .HealthMessage != nil {
@@ -447,10 +450,6 @@ func RunRuntimeList(ctx context.Context) error {
447450 cluster = * rt .Cluster
448451 }
449452
450- if rt .Metadata .Name != "" {
451- name = rt .Metadata .Name
452- }
453-
454453 if rt .RuntimeVersion != nil {
455454 version = * rt .RuntimeVersion
456455 }
0 commit comments