From a43508b0e751367749b206af6ecad56fc6759dcb Mon Sep 17 00:00:00 2001 From: ashnamehrotra Date: Fri, 21 Jun 2024 12:44:37 -0700 Subject: [PATCH] lint fixes Signed-off-by: ashnamehrotra --- pkg/buildkit/buildkit.go | 16 ---------------- pkg/pkgmgr/rpm.go | 8 ++++++-- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/pkg/buildkit/buildkit.go b/pkg/buildkit/buildkit.go index 7bc7802b..0555d694 100644 --- a/pkg/buildkit/buildkit.go +++ b/pkg/buildkit/buildkit.go @@ -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 diff --git a/pkg/pkgmgr/rpm.go b/pkg/pkgmgr/rpm.go index 8c377943..5ead8a80 100644 --- a/pkg/pkgmgr/rpm.go +++ b/pkg/pkgmgr/rpm.go @@ -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) stateWithDnf := rm.config.ImageState.Run(llb.Shlex(checkUpdate)).Root() _, err := buildkit.ExtractFileFromState(ctx, rm.config.Client, &stateWithDnf, "/updates.txt") + if err != nil { + log.Error(err) + return err + } - // 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