Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Do not store duplicate mountpoints in device connection. #5126

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading