Fix error while parsing yum check-update #24

This commit is contained in:
kota kanbe
2016-04-14 20:28:01 +09:00
parent d0d360a6e7
commit cd9cbd795b
2 changed files with 34 additions and 3 deletions

View File

@@ -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)