Skip to content

Commit

Permalink
Fix the santisedDevices logic for ubuntu nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
handerajat authored and l-technicore committed Nov 27, 2024
1 parent 4a88576 commit 00f947b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/util/disk/iscsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,12 @@ func GetDiskPathFromBindDeviceFilePath(logger *zap.SugaredLogger, mountPath stri

var sanitizedDevices []string
for _, dev := range devices {
sanitizedDevice := strings.TrimPrefix(dev, "devtmpfs[")
sanitizedDevice = strings.TrimSuffix(sanitizedDevice, "]")
sanitizedDevice = filepath.Clean(sanitizedDevice) // Fix extra slashes
sanitizedDevices = append(sanitizedDevices, sanitizedDevice)
if prefixEnd := strings.Index(dev, "["); prefixEnd != -1 {
sanitizedDevice := dev[prefixEnd+1:] // Start after `[`
sanitizedDevice = strings.TrimSuffix(sanitizedDevice, "]")
sanitizedDevice = filepath.Clean(sanitizedDevice) // Fix extra slashes
sanitizedDevices = append(sanitizedDevices, sanitizedDevice)
}
}

if len(sanitizedDevices) != 1 {
Expand Down

0 comments on commit 00f947b

Please sign in to comment.