diff --git a/scan/redhat.go b/scan/redhat.go index 97042d75ab..43507435d3 100644 --- a/scan/redhat.go +++ b/scan/redhat.go @@ -300,7 +300,7 @@ func (o *redhat) scanUnsecurePackagesUsingYumCheckUpdate() (CvePacksList, error) if err != nil { return nil, fmt.Errorf("Failed to parse %s. err: %s", cmd, err) } - o.log.Debugf("%s", pp.Sprintf("%s", packInfoList)) + o.log.Debugf("%s", pp.Sprintf("%v", packInfoList)) // Collect CVE-IDs in changelog type PackInfoCveIDs struct { @@ -409,9 +409,12 @@ func (o *redhat) parseYumCheckUpdateLines(stdout string) (results models.Package continue } if needToParse { + if strings.HasPrefix(line, "Obsoleting") { + continue + } candidate, err := o.parseYumCheckUpdateLine(line) if err != nil { - return models.PackageInfoList{}, err + return results, err } installed, found := o.Packages.FindByName(candidate.Name) diff --git a/scan/redhat_test.go b/scan/redhat_test.go index ce54d5fb55..a852de410d 100644 --- a/scan/redhat_test.go +++ b/scan/redhat_test.go @@ -556,7 +556,11 @@ Loading mirror speeds from cached hostfile audit-libs.x86_64 2.3.7-5.el6 base bash.x86_64 4.1.2-33.el6_7.1 updates - ` +Obsoleting Packages +python-libs.i686 2.6.6-64.el6 rhui-REGION-rhel-server-releases + python-ordereddict.noarch 1.1-3.el6ev installed +` + r.Packages = []models.PackageInfo{ { Name: "audit-libs", @@ -568,6 +572,16 @@ bash.x86_64 4.1.2-33.el6_7.1 updates Version: "4.1.1", Release: "33", }, + { + Name: "python-libs", + Version: "2.6.0", + Release: "1.1-0", + }, + { + Name: "python-ordereddict", + Version: "1.0", + Release: "1", + }, } var tests = []struct { in string @@ -590,6 +604,20 @@ bash.x86_64 4.1.2-33.el6_7.1 updates NewVersion: "4.1.2", NewRelease: "33.el6_7.1", }, + { + Name: "python-libs", + Version: "2.6.0", + Release: "1.1-0", + NewVersion: "2.6.6", + NewRelease: "64.el6", + }, + { + Name: "python-ordereddict", + Version: "1.0", + Release: "1", + NewVersion: "1.1", + NewRelease: "3.el6ev", + }, }, }, }