Skip to content

Commit

Permalink
fix(scanner/redhat): make cache before detect dnf modules (#1812)
Browse files Browse the repository at this point in the history
Co-authored-by: wadahiroka <wadahiroka@192.168.0.4>
  • Loading branch information
wadda0714 and wadahiroka committed Dec 15, 2023
1 parent d122499 commit b2c9117
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scanner/redhatbase.go
Expand Up @@ -420,6 +420,10 @@ func (o *redhatBase) scanPackages() (err error) {
return xerrors.Errorf("Failed to scan installed packages: %w", err)
}

if err := o.yumMakeCache(); err != nil {
return xerrors.Errorf("Failed to execute `yum makecache`: %w", err)
}

if o.EnabledDnfModules, err = o.detectEnabledDnfModules(); err != nil {
return xerrors.Errorf("Failed to detect installed dnf modules: %w", err)
}
Expand Down Expand Up @@ -645,10 +649,6 @@ func (o *redhatBase) yumMakeCache() error {
}

func (o *redhatBase) scanUpdatablePackages() (models.Packages, error) {
if err := o.yumMakeCache(); err != nil {
return nil, xerrors.Errorf("Failed to `yum makecache`: %w", err)
}

isDnf := o.exec(util.PrependProxyEnv(`repoquery --version | grep dnf`), o.sudo.repoquery()).isSuccess()
cmd := `repoquery --all --pkgnarrow=updates --qf='%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{REPO}'`
if isDnf {
Expand Down

0 comments on commit b2c9117

Please sign in to comment.