csi: when warning for multiple prefix matches, use full ID (#11853)
When the `volume deregister` or `volume detach` commands get an ID prefix that matches multiple volumes, show the full length of the volume IDs in the list of volumes shown so so that the user can select the correct one.
This commit is contained in:
parent
9c4864badd
commit
33f7c6cba4
|
@ -0,0 +1,3 @@
|
||||||
|
```bug
|
||||||
|
csi: Fixed a bug in `volume deregister` and `volume detach` commands where volume IDs were truncated when asking the user to select one of several prefix matches
|
||||||
|
```
|
|
@ -101,7 +101,7 @@ func (c *VolumeDeregisterCommand) Run(args []string) int {
|
||||||
}
|
}
|
||||||
if len(vols) > 1 {
|
if len(vols) > 1 {
|
||||||
sort.Slice(vols, func(i, j int) bool { return vols[i].ID < vols[j].ID })
|
sort.Slice(vols, func(i, j int) bool { return vols[i].ID < vols[j].ID })
|
||||||
out, err := csiFormatSortedVolumes(vols, shortId)
|
out, err := csiFormatSortedVolumes(vols, fullId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Ui.Error(fmt.Sprintf("Error formatting: %s", err))
|
c.Ui.Error(fmt.Sprintf("Error formatting: %s", err))
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -123,7 +123,7 @@ func (c *VolumeDetachCommand) Run(args []string) int {
|
||||||
}
|
}
|
||||||
if len(vols) > 1 {
|
if len(vols) > 1 {
|
||||||
sort.Slice(vols, func(i, j int) bool { return vols[i].ID < vols[j].ID })
|
sort.Slice(vols, func(i, j int) bool { return vols[i].ID < vols[j].ID })
|
||||||
out, err := csiFormatSortedVolumes(vols, shortId)
|
out, err := csiFormatSortedVolumes(vols, fullId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Ui.Error(fmt.Sprintf("Error formatting: %s", err))
|
c.Ui.Error(fmt.Sprintf("Error formatting: %s", err))
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in New Issue