fix(report): Error when GitHub integration failed (#800)

This commit is contained in:
Kota Kanbe
2019-04-15 21:51:04 +09:00
committed by GitHub
parent 6a1fc4fade
commit 533d05a1b5
15 changed files with 74 additions and 66 deletions

View File

@@ -139,7 +139,7 @@ func NewGostDB(cnf DBClientConf) (driver gostdb.DB, locked bool, err error) {
util.Log.Debugf("Open gost db (%s): %s", cnf.GostCnf.Type, path)
if driver, locked, err = gostdb.NewDB(cnf.GostCnf.Type, path, cnf.DebugSQL); err != nil {
if locked {
util.Log.Errorf("gostDB is locked: %s", err)
util.Log.Errorf("gostDB is locked. err: %+v", err)
return nil, true, err
}
return nil, false, err
@@ -165,7 +165,7 @@ func NewExploitDB(cnf DBClientConf) (driver exploitdb.DB, locked bool, err error
util.Log.Debugf("Open exploit db (%s): %s", cnf.ExploitCnf.Type, path)
if driver, locked, err = exploitdb.NewDB(cnf.ExploitCnf.Type, path, cnf.DebugSQL); err != nil {
if locked {
util.Log.Errorf("exploitDB is locked: %s", err)
util.Log.Errorf("exploitDB is locked. err: %+v", err)
return nil, true, err
}
return nil, false, err
@@ -177,12 +177,12 @@ func NewExploitDB(cnf DBClientConf) (driver exploitdb.DB, locked bool, err error
func (d DBClient) CloseDB() {
if d.CveDB != nil {
if err := d.CveDB.CloseDB(); err != nil {
util.Log.Errorf("Failed to close DB: %s", err)
util.Log.Errorf("Failed to close DB. err: %+v", err)
}
}
if d.OvalDB != nil {
if err := d.OvalDB.CloseDB(); err != nil {
util.Log.Errorf("Failed to close DB: %s", err)
util.Log.Errorf("Failed to close DB. err: %+v", err)
}
}
}

View File

@@ -186,7 +186,7 @@ func FillCveInfo(dbclient DBClient, r *models.ScanResult, cpeURIs []string, inte
ints := &integrationResults{}
for _, o := range integrations {
if err = o.apply(r, ints); err != nil {
return err
return xerrors.Errorf("Failed to fill with integration: %w", err)
}
}
util.Log.Infof("%s: %d CVEs are detected with GitHub Security Alerts", r.FormatServerName(), ints.GithubAlertsCveCounts)

View File

@@ -67,7 +67,7 @@ func (w SaasWriter) Write(rs ...models.ScanResult) (err error) {
ipv4s, ipv6s, err := util.IP()
if err != nil {
util.Log.Errorf("Failed to fetch scannedIPs: %s", err)
util.Log.Errorf("Failed to fetch scannedIPs. err: %+v", err)
}
hostname, _ := os.Hostname()

View File

@@ -56,14 +56,14 @@ func RunTui(results models.ScanResults) subcommands.ExitStatus {
g, err := gocui.NewGui(gocui.OutputNormal)
if err != nil {
util.Log.Errorf("%s", err)
util.Log.Errorf("%+v", err)
return subcommands.ExitFailure
}
defer g.Close()
g.SetManagerFunc(layout)
if err := keybindings(g); err != nil {
util.Log.Errorf("%s", err)
util.Log.Errorf("%+v", err)
return subcommands.ExitFailure
}
g.SelBgColor = gocui.ColorGreen
@@ -72,7 +72,7 @@ func RunTui(results models.ScanResults) subcommands.ExitStatus {
if err := g.MainLoop(); err != nil {
g.Close()
util.Log.Errorf("%s", err)
util.Log.Errorf("%+v", err)
os.Exit(1)
}
return subcommands.ExitSuccess

View File

@@ -399,7 +399,7 @@ func loadPrevious(currs models.ScanResults) (prevs models.ScanResults, err error
path := filepath.Join(dir, filename)
r, err := loadOneServerScanResult(path)
if err != nil {
util.Log.Errorf("%s", err)
util.Log.Errorf("%+v", err)
continue
}
if r.Family == result.Family && r.Release == result.Release {