Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csi: fix CLI panic when formatting volume status with -verbose flag #10818

Merged
merged 1 commit into from
Jun 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
10 changes: 4 additions & 6 deletions command/volume_status_csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down