Skip to content

Commit

Permalink
csi: avoid panic in CLI for failed node attachment cleanup
Browse files Browse the repository at this point in the history
If the node API returns an attached volume that doesn't belong to an
alloc (because it's failed to clean up properly), `nomad node status`
will panic when rendering the response.
  • Loading branch information
tgross committed Jul 23, 2020
1 parent 1cb9e75 commit 2c9cad2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions command/node_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,10 @@ func (c *NodeStatusCommand) outputNodeCSIVolumeInfo(client *api.Client, node *ap
volumes := map[string]*api.CSIVolumeListStub{}
vs, _ := client.Nodes().CSIVolumes(node.ID, nil)
for _, v := range vs {
n := requests[v.ID].Name
volumes[n] = v
n, ok := requests[v.ID]
if ok {
volumes[n.Name] = v
}
}

// Output the volumes in name order
Expand Down

0 comments on commit 2c9cad2

Please sign in to comment.