Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
Signed-off-by: ashnamehrotra <[email protected]>
  • Loading branch information
ashnamehrotra committed Jun 21, 2024
1 parent 5a67c60 commit a43508b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
16 changes: 0 additions & 16 deletions pkg/buildkit/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,6 @@ func InitializeBuildkitConfig(ctx context.Context, c gwclient.Client, image stri
return &config, nil
}

func FetchRef(client gwclient.Client, st llb.State, ctx context.Context, opts ...llb.ConstraintsOpt) (*gwclient.Result, error) {
def, err := st.Marshal(ctx, opts...)
if err != nil {
return nil, err
}

res, err := client.Solve(ctx, gwclient.SolveRequest{
Definition: def.ToPB(),
})
if err != nil {
return nil, err
}

return res, nil
}

// Extracts the bytes of the file denoted by `path` from the state `st`.
func ExtractFileFromState(ctx context.Context, c gwclient.Client, st *llb.State, path string) ([]byte, error) {
// since platform is obtained from host, override it in the case of Darwin
Expand Down
8 changes: 6 additions & 2 deletions pkg/pkgmgr/rpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,14 +448,18 @@ func (rm *rpmManager) installUpdates(ctx context.Context, updates unversioned.Up
}

func (rm *rpmManager) checkForUpgrades(ctx context.Context, toolPath string) error {
checkUpdateTemplate := `sh -c "%[1]s install dnf; dnf check-update; if [ $? -ne 0 ]; then echo >> /updates.txt; fi;"`
checkUpdateTemplate := `sh -c "set -x; %[1]s install dnf -y; dnf check-update -y; if [ $? -ne 0 ]; then echo >> /updates.txt; fi;"`
checkUpdate := fmt.Sprintf(checkUpdateTemplate, toolPath)

Check warning on line 452 in pkg/pkgmgr/rpm.go

View check run for this annotation

Codecov / codecov/patch

pkg/pkgmgr/rpm.go#L450-L452

Added lines #L450 - L452 were not covered by tests

stateWithDnf := rm.config.ImageState.Run(llb.Shlex(checkUpdate)).Root()

Check warning on line 454 in pkg/pkgmgr/rpm.go

View check run for this annotation

Codecov / codecov/patch

pkg/pkgmgr/rpm.go#L454

Added line #L454 was not covered by tests

_, err := buildkit.ExtractFileFromState(ctx, rm.config.Client, &stateWithDnf, "/updates.txt")
if err != nil {
log.Error(err)
return err

Check warning on line 459 in pkg/pkgmgr/rpm.go

View check run for this annotation

Codecov / codecov/patch

pkg/pkgmgr/rpm.go#L456-L459

Added lines #L456 - L459 were not covered by tests
}

// if error in extracting file, that means updates.txt does not exist and there are no updates
// if error in extracting file, that means updates.txt does not exist and there are no updates.
if err != nil {
log.Error(err)
return err

Check warning on line 465 in pkg/pkgmgr/rpm.go

View check run for this annotation

Codecov / codecov/patch

pkg/pkgmgr/rpm.go#L463-L465

Added lines #L463 - L465 were not covered by tests
Expand Down

0 comments on commit a43508b

Please sign in to comment.