@@ -296,7 +296,10 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
296
296
var wg sync.WaitGroup
297
297
298
298
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
+ }
300
303
wg .Wait ()
301
304
302
305
log .G (ctx ).Infof ("done installing runtime '%s'" , opts .RuntimeName )
@@ -372,12 +375,13 @@ func checkExistingRuntimes(ctx context.Context, runtime string) error {
372
375
return nil
373
376
}
374
377
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 {
376
379
interval := time .Duration (milliseconds ) * time .Millisecond
377
380
ticker := time .NewTicker (interval )
378
381
var err error
379
382
380
383
for retries := 20 ; retries > 0 ; <- ticker .C {
384
+ retries --
381
385
fmt .Println ("waiting for the runtime installation to complete..." )
382
386
var runtimes []model.Runtime
383
387
runtimes , err = cfConfig .NewClient ().V2 ().Runtime ().List (ctx )
@@ -389,14 +393,13 @@ func intervalCheckIsRuntimePersisted(milliseconds int, ctx context.Context, runt
389
393
if rt .Metadata .Name == runtimeName {
390
394
wg .Done ()
391
395
ticker .Stop ()
392
- return
396
+ return nil
393
397
}
394
398
}
395
399
396
- retries --
397
400
}
398
401
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 )
400
403
}
401
404
402
405
func NewRuntimeListCommand () * cobra.Command {
@@ -432,7 +435,7 @@ func RunRuntimeList(ctx context.Context) error {
432
435
status := "N/A"
433
436
namespace := "N/A"
434
437
cluster := "N/A"
435
- name := "N/A"
438
+ name := rt . Metadata . Name
436
439
version := "N/A"
437
440
438
441
if rt .Self .HealthMessage != nil {
@@ -447,10 +450,6 @@ func RunRuntimeList(ctx context.Context) error {
447
450
cluster = * rt .Cluster
448
451
}
449
452
450
- if rt .Metadata .Name != "" {
451
- name = rt .Metadata .Name
452
- }
453
-
454
453
if rt .RuntimeVersion != nil {
455
454
version = * rt .RuntimeVersion
456
455
}
0 commit comments