Skip to content

Commit

Permalink
simplify search (start with 0)
Browse files Browse the repository at this point in the history
  • Loading branch information
slntopp committed Oct 23, 2024
1 parent c3df3fe commit 7c20e48
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions providers/os/connection/snapshot/blockdevices.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ func (blockEntries *BlockDevices) findAlias(alias, path string) {
for i := range blockEntries.BlockDevices {
device := blockEntries.BlockDevices[i]
if alias == device.Name {
log.Debug().
Str("alias", alias).
Str("path", path).
Str("name", device.Name).
Msg("found alias")
device.Aliases = append(device.Aliases, path)
blockEntries.BlockDevices[i] = device
return
Expand Down Expand Up @@ -216,11 +221,11 @@ func (blockEntries BlockDevices) FindDevice(requested string) (BlockDevice, erro
Device BlockDevice
Lms int
}{
Device: devices[0],
Lms: LongestMatchingSuffix(requested, devices[0].Name),
Device: BlockDevice{},
Lms: 0,
}

for i := 1; i < len(devices); i++ {
for i := 0; i < len(devices); i++ {
log.Debug().
Str("name", devices[i].Name).
Strs("aliases", devices[i].Aliases).
Expand Down

0 comments on commit 7c20e48

Please sign in to comment.