diff --git a/CHANGELOG.md b/CHANGELOG.md index 74eadb76f7b8..c62206434e6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## 1.1.3 (Unreleased) +BUG FIXES: +csi: fixed a CLI panic when formatting `volume status` with `-verbose` flag [[GH-10818](https://github.com/hashicorp/nomad/issues/10818)] + ## 1.1.2 (June 22, 2021) IMPROVEMENTS: diff --git a/command/volume_status_csi.go b/command/volume_status_csi.go index 0bf08dd45ce3..9b17e6cda42f 100644 --- a/command/volume_status_csi.go +++ b/command/volume_status_csi.go @@ -119,19 +119,17 @@ NEXT_PLUGIN: // rather than an empty list continue NEXT_PLUGIN } - rows := []string{} - rows[0] = "External ID|Condition|Nodes" - for i, v := range externalList.Volumes { + rows := []string{"External ID|Condition|Nodes"} + for _, v := range externalList.Volumes { condition := "OK" if v.IsAbnormal { condition = fmt.Sprintf("Abnormal (%v)", v.Status) } - - rows[i+1] = fmt.Sprintf("%s|%s|%s", + rows = append(rows, fmt.Sprintf("%s|%s|%s", limit(v.ExternalID, c.length), limit(condition, 20), strings.Join(v.PublishedExternalNodeIDs, ","), - ) + )) } c.Ui.Output(formatList(rows))