Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <[email protected]>
  • Loading branch information
imilchev committed Feb 23, 2024
1 parent f5c9b4c commit 0a57d10
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
22 changes: 13 additions & 9 deletions providers/os/connection/docker/container_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,18 @@ func NewWithReader(id uint32, conf *inventory.Config, asset *inventory.Asset, rc
}
}

return tar.NewTarConnectionWithClose(id, &inventory.Config{
Type: "tar",
Runtime: "docker-image",
Options: map[string]string{
tar.OPTION_FILE: filename,
return tar.NewTarConnection(
id,
&inventory.Config{
Type: "tar",
Runtime: "docker-image",
Options: map[string]string{
tar.OPTION_FILE: filename,
},
},
}, asset, func() {
log.Debug().Str("tar", filename).Msg("tar> remove temporary tar file on connection close")
os.Remove(filename)
})
asset,
tar.WithCloseFn(func() {
log.Debug().Str("tar", filename).Msg("tar> remove temporary tar file on connection close")
os.Remove(filename)
}))
}
22 changes: 13 additions & 9 deletions providers/os/connection/docker/snapshot_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type DockerSnapshotConnection struct {
}

func NewDockerSnapshotConnection(id uint32, conf *inventory.Config, asset *inventory.Asset) (*DockerSnapshotConnection, error) {
tarConnection, err := tar.NewTarConnectionWithClose(id, conf, asset, func() {})
tarConnection, err := tar.NewTarConnection(id, conf, asset)
if err != nil {
return nil, err
}
Expand All @@ -42,15 +42,19 @@ func NewFromDockerEngine(id uint32, conf *inventory.Config, asset *inventory.Ass
return nil, err
}

tarConnection, err := tar.NewTarConnectionWithClose(id, &inventory.Config{
Type: "tar",
Options: map[string]string{
tar.OPTION_FILE: f.Name(),
tarConnection, err := tar.NewTarConnection(
id,
&inventory.Config{
Type: "tar",
Options: map[string]string{
tar.OPTION_FILE: f.Name(),
},
},
}, asset, func() {
// remove temporary file on stream close
os.Remove(f.Name())
})
asset,
tar.WithCloseFn(func() {
// remove temporary file on stream close
os.Remove(f.Name())
}))
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/os/connection/fs/filesystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/stretchr/testify/require"
"go.mondoo.com/cnquery/v10/providers-sdk/v1/inventory"
"go.mondoo.com/cnquery/v10/providers/os/connection/fs"
"go.mondoo.com/cnquery/v10/providers/os/connection/fs/fsutil"
"go.mondoo.com/cnquery/v10/providers/os/detector"
"go.mondoo.com/cnquery/v10/providers/os/fsutil"
)

func TestOsDetection(t *testing.T) {
Expand Down

0 comments on commit 0a57d10

Please sign in to comment.