Skip to content

Commit 2c9cad2

Browse files
committed
csi: avoid panic in CLI for failed node attachment cleanup
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.
1 parent 1cb9e75 commit 2c9cad2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

command/node_status.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,10 @@ func (c *NodeStatusCommand) outputNodeCSIVolumeInfo(client *api.Client, node *ap
563563
volumes := map[string]*api.CSIVolumeListStub{}
564564
vs, _ := client.Nodes().CSIVolumes(node.ID, nil)
565565
for _, v := range vs {
566-
n := requests[v.ID].Name
567-
volumes[n] = v
566+
n, ok := requests[v.ID]
567+
if ok {
568+
volumes[n.Name] = v
569+
}
568570
}
569571

570572
// Output the volumes in name order

0 commit comments

Comments
 (0)