Skip to content

Commit

Permalink
Merge pull request #238 from future-architect/debcache
Browse files Browse the repository at this point in the history
Fix changelog cache bug on Ubuntu and Debian #235
  • Loading branch information
kotakanbe authored Nov 1, 2016
2 parents 406efa9 + 7681b27 commit 7cd7b4a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scan/debian.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ func (o *debian) getChangelogCache(meta cache.Meta, pack models.PackageInfo) str
}
changelog, err := cache.DB.GetChangelog(meta.Name, pack.Name)
if err != nil {
o.log.Warnf("Failed to get chnagelog. bucket: %s, key:%s, err: %s",
o.log.Warnf("Failed to get changelog. bucket: %s, key:%s, err: %s",
meta.Name, pack.Name, err)
return ""
}
Expand Down Expand Up @@ -541,11 +541,13 @@ func (o *debian) scanPackageCveIDs(pack models.PackageInfo) ([]string, error) {
o.log.Warnf("Failed to SSH: %s", r)
// Ignore this Error.
return nil, nil

}
err := cache.DB.PutChangelog(o.getServerInfo().GetServerName(), pack.Name, r.Stdout)
if err != nil {
return nil, fmt.Errorf("Failed to put changelog into cache")

if 0 < len(strings.TrimSpace(r.Stdout)) {
err := cache.DB.PutChangelog(o.getServerInfo().GetServerName(), pack.Name, r.Stdout)
if err != nil {
return nil, fmt.Errorf("Failed to put changelog into cache")
}
}
// No error will be returned. Only logging.
return o.getCveIDFromChangelog(r.Stdout, pack.Name, pack.Version), nil
Expand Down

0 comments on commit 7cd7b4a

Please sign in to comment.