@@ -518,7 +518,6 @@ func (c *NodeStatusCommand) outputTruncatedNodeDriverInfo(node *api.Node) string
518
518
}
519
519
520
520
func (c * NodeStatusCommand ) outputNodeVolumeInfo (node * api.Node ) {
521
- c .Ui .Output (c .Colorize ().Color ("\n [bold]Host Volumes" ))
522
521
523
522
names := make ([]string , 0 , len (node .HostVolumes ))
524
523
for name := range node .HostVolumes {
@@ -529,15 +528,17 @@ func (c *NodeStatusCommand) outputNodeVolumeInfo(node *api.Node) {
529
528
output := make ([]string , 0 , len (names )+ 1 )
530
529
output = append (output , "Name|ReadOnly|Source" )
531
530
532
- for _ , volName := range names {
533
- info := node .HostVolumes [volName ]
534
- output = append (output , fmt .Sprintf ("%s|%v|%s" , volName , info .ReadOnly , info .Path ))
531
+ if len (names ) > 0 {
532
+ c .Ui .Output (c .Colorize ().Color ("\n [bold]Host Volumes" ))
533
+ for _ , volName := range names {
534
+ info := node .HostVolumes [volName ]
535
+ output = append (output , fmt .Sprintf ("%s|%v|%s" , volName , info .ReadOnly , info .Path ))
536
+ }
537
+ c .Ui .Output (formatList (output ))
535
538
}
536
- c .Ui .Output (formatList (output ))
537
539
}
538
540
539
541
func (c * NodeStatusCommand ) outputNodeCSIVolumeInfo (client * api.Client , node * api.Node , runningAllocs []* api.Allocation ) {
540
- c .Ui .Output (c .Colorize ().Color ("\n [bold]CSI Volumes" ))
541
542
542
543
// Duplicate nodeCSIVolumeNames to sort by name but also index volume names to ids
543
544
var names []string
@@ -569,23 +570,27 @@ func (c *NodeStatusCommand) outputNodeCSIVolumeInfo(client *api.Client, node *ap
569
570
}
570
571
}
571
572
572
- // Output the volumes in name order
573
- output := make ([]string , 0 , len (names )+ 1 )
574
- output = append (output , "ID|Name|Plugin ID|Schedulable|Provider|Access Mode" )
575
- for _ , name := range names {
576
- v := volumes [name ]
577
- output = append (output , fmt .Sprintf (
578
- "%s|%s|%s|%t|%s|%s" ,
579
- v .ID ,
580
- name ,
581
- v .PluginID ,
582
- v .Schedulable ,
583
- v .Provider ,
584
- v .AccessMode ,
585
- ))
586
- }
587
-
588
- c .Ui .Output (formatList (output ))
573
+ if len (names ) > 0 {
574
+ c .Ui .Output (c .Colorize ().Color ("\n [bold]CSI Volumes" ))
575
+
576
+ // Output the volumes in name order
577
+ output := make ([]string , 0 , len (names )+ 1 )
578
+ output = append (output , "ID|Name|Plugin ID|Schedulable|Provider|Access Mode" )
579
+ for _ , name := range names {
580
+ v := volumes [name ]
581
+ output = append (output , fmt .Sprintf (
582
+ "%s|%s|%s|%t|%s|%s" ,
583
+ v .ID ,
584
+ name ,
585
+ v .PluginID ,
586
+ v .Schedulable ,
587
+ v .Provider ,
588
+ v .AccessMode ,
589
+ ))
590
+ }
591
+
592
+ c .Ui .Output (formatList (output ))
593
+ }
589
594
}
590
595
591
596
func (c * NodeStatusCommand ) outputNodeDriverInfo (node * api.Node ) {
0 commit comments