Skip to content

Commit

Permalink
🐛 Do not store duplicate mountpoints. (#5126)
Browse files Browse the repository at this point in the history
Signed-off-by: Preslav <[email protected]>
  • Loading branch information
preslavgerchev authored Jan 29, 2025
1 parent b3c787a commit 980aa20
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions providers/os/connection/device/device_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ func NewDeviceConnection(connId uint32, conf *inventory.Config, asset *inventory
}
block.MountPoint = scanDir
}
res.MountedDirs = append(res.MountedDirs, block.MountPoint)
if !stringx.Contains(res.MountedDirs, block.MountPoint) {
res.MountedDirs = append(res.MountedDirs, block.MountPoint)
}

res.partitions[block.MountPoint] = block

if asset.Platform != nil {
Expand Down Expand Up @@ -236,14 +239,12 @@ func tryDetectAsset(connId uint32, partition *snapshot.PartitionInfo, conf *inve
fingerprint, p, err := id.IdentifyPlatform(fsConn, &plugin.ConnectReq{}, p, asset.IdDetector)
if err != nil {
if len(asset.PlatformIds) == 0 {
log.Debug().Err(err).
Msg("device connection> failed to identify platform from device")
log.Debug().Err(err).Msg("device connection> failed to identify platform from device")
return nil, err
}

log.Warn().Err(err).
Msg("device connection> failed to identify platform from device, using existing platform ids")
log.Warn().Err(err).Msg("device connection> cannot detect platform ids, using existing ones")
}

if p == nil {
log.Debug().Msg("device connection> no platform detected")
return nil, errors.New("device connection> no platform detected")
Expand Down

0 comments on commit 980aa20

Please sign in to comment.