Fix unbold header `Device Group Attributes` and remove unused var in func `nodeCSIVolumeNames` (#16138)

* Fix  unbold header and remove unused var in  func
Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>

* Add CHANGELOG file
Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>

* Apply suggestions from review <Charlie Voiselle>

---------

Signed-off-by: dttung2905 <ttdao.2015@accountancy.smu.edu.sg>
Co-authored-by: Charlie Voiselle <464492+angrycub@users.noreply.github.com>
Co-authored-by: Tim Gross <tgross@hashicorp.com>
This commit is contained in:
Dao Thanh Tung 2023-02-14 04:33:12 +08:00 committed by GitHub
parent f7df32428a
commit 6d6b46f2cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

3
.changelog/16138.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
cli: Fix unbolded header `Device Group Attributes`
```

View File

@ -399,7 +399,7 @@ func nodeCSINodeNames(n *api.Node) []string {
return names return names
} }
func nodeCSIVolumeNames(n *api.Node, allocs []*api.Allocation) []string { func nodeCSIVolumeNames(allocs []*api.Allocation) []string {
var names []string var names []string
for _, alloc := range allocs { for _, alloc := range allocs {
tg := alloc.GetTaskGroup() tg := alloc.GetTaskGroup()
@ -489,7 +489,7 @@ func (c *NodeStatusCommand) formatNode(client *api.Client, node *api.Node) int {
if c.short { if c.short {
basic = append(basic, fmt.Sprintf("Host Volumes|%s", strings.Join(nodeVolumeNames(node), ","))) basic = append(basic, fmt.Sprintf("Host Volumes|%s", strings.Join(nodeVolumeNames(node), ",")))
basic = append(basic, fmt.Sprintf("Host Networks|%s", strings.Join(nodeNetworkNames(node), ","))) basic = append(basic, fmt.Sprintf("Host Networks|%s", strings.Join(nodeNetworkNames(node), ",")))
basic = append(basic, fmt.Sprintf("CSI Volumes|%s", strings.Join(nodeCSIVolumeNames(node, runningAllocs), ","))) basic = append(basic, fmt.Sprintf("CSI Volumes|%s", strings.Join(nodeCSIVolumeNames(runningAllocs), ",")))
basic = append(basic, fmt.Sprintf("Drivers|%s", strings.Join(nodeDrivers(node), ","))) basic = append(basic, fmt.Sprintf("Drivers|%s", strings.Join(nodeDrivers(node), ",")))
c.Ui.Output(c.Colorize().Color(formatKV(basic))) c.Ui.Output(c.Colorize().Color(formatKV(basic)))
@ -518,7 +518,7 @@ func (c *NodeStatusCommand) formatNode(client *api.Client, node *api.Node) int {
if !c.verbose { if !c.verbose {
basic = append(basic, fmt.Sprintf("Host Volumes|%s", strings.Join(nodeVolumeNames(node), ","))) basic = append(basic, fmt.Sprintf("Host Volumes|%s", strings.Join(nodeVolumeNames(node), ",")))
basic = append(basic, fmt.Sprintf("Host Networks|%s", strings.Join(nodeNetworkNames(node), ","))) basic = append(basic, fmt.Sprintf("Host Networks|%s", strings.Join(nodeNetworkNames(node), ",")))
basic = append(basic, fmt.Sprintf("CSI Volumes|%s", strings.Join(nodeCSIVolumeNames(node, runningAllocs), ","))) basic = append(basic, fmt.Sprintf("CSI Volumes|%s", strings.Join(nodeCSIVolumeNames(runningAllocs), ",")))
driverStatus := fmt.Sprintf("Driver Status| %s", c.outputTruncatedNodeDriverInfo(node)) driverStatus := fmt.Sprintf("Driver Status| %s", c.outputTruncatedNodeDriverInfo(node))
basic = append(basic, driverStatus) basic = append(basic, driverStatus)
} }
@ -821,7 +821,7 @@ func (c *NodeStatusCommand) formatDeviceAttributes(node *api.Node) {
} }
if first { if first {
c.Ui.Output("\nDevice Group Attributes") c.Ui.Output("\n[bold]Device Group Attributes[reset]")
first = false first = false
} else { } else {
c.Ui.Output("") c.Ui.Output("")