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

🐛 Fix platformID for containers #1951

Merged
merged 2 commits into from
Sep 27, 2023
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
11 changes: 8 additions & 3 deletions providers/os/connection/docker_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ func NewDockerEngineContainer(id uint32, conf *inventory.Config, asset *inventor
conn.PlatformIdentifier = containerid.MondooContainerID(ci.ID)
conn.Metadata.Name = containerid.ShortContainerImageID(ci.ID)
conn.Metadata.Labels = ci.Labels
conn.Asset().Name = ci.Name
asset.Name = ci.Name
asset.PlatformIds = []string{containerid.MondooContainerID(ci.ID)}
return conn, nil
} else {
log.Debug().Msg("found stopped container " + ci.ID)
Expand All @@ -268,7 +269,8 @@ func NewDockerEngineContainer(id uint32, conf *inventory.Config, asset *inventor
conn.PlatformIdentifier = containerid.MondooContainerID(ci.ID)
conn.Metadata.Name = containerid.ShortContainerImageID(ci.ID)
conn.Metadata.Labels = ci.Labels
conn.Asset().Name = ci.Name
asset.Name = ci.Name
asset.PlatformIds = []string{containerid.MondooContainerID(ci.ID)}
return conn, nil
}
}
Expand All @@ -295,7 +297,10 @@ func NewDockerContainerImageConnection(id uint32, conf *inventory.Config, asset

// The requested image isn't locally available, but we can pull it from a remote registry.
if len(resolvedAssets) > 0 && resolvedAssets[0].Connections[0].Type == "container-registry" {
return NewContainerRegistryImage(id, conf, resolvedAssets[0])
asset.Name = resolvedAssets[0].Name
asset.PlatformIds = resolvedAssets[0].PlatformIds
asset.Labels = resolvedAssets[0].Labels
return NewContainerRegistryImage(id, conf, asset)
}

// could be an image id/name, container id/name or a short reference to an image in docker engine
Expand Down
Loading