Skip to content

Commit

Permalink
fix empty volume group creation through cli tool
Browse files Browse the repository at this point in the history
when creating empty volume group through cli, the strings.Split()
function returns a [""] value, i.e, a slice of length 1 having
the value as 1 `[""]` empty string. As a result, csi panics
when it tries to find the volumeID with the respective value.

Signed-off-by: Nikhil-Ladha <[email protected]>
  • Loading branch information
Nikhil-Ladha authored and mergify[bot] committed Feb 13, 2025
1 parent 57593e1 commit f8e615a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/csi-addons/volumegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ func (vgb *VolumeGroupBase) SetParameters(parameters string) error {
return nil
}

// SetVolumeIDs sets and parses the volume IDs
// SetVolumeIDs sets and parses the volume IDs, only if volumeids are provided.
func (vgb *VolumeGroupBase) SetVolumeIDs(volumeids string) {
volumeIDs := strings.Split(volumeids, ",")
vgb.volumeIDs = volumeIDs
if volumeids != "" {
volumeIDs := strings.Split(volumeids, ",")
vgb.volumeIDs = volumeIDs
}
}

// Parses the parameters to convert them from string format to map[string]string format
Expand Down

0 comments on commit f8e615a

Please sign in to comment.