fix(scan): enable to report if some warnings occured on scanning (#805)

* fix(scan): enable to report if some warnings occured on scanning

* alpine, debian, freebsd, suse

* -format-full-text, -format-list, -format-one-line-text

* implement slack.go

* implement tui.go

* go fmt
This commit is contained in:
Kota Kanbe
2019-06-12 21:35:21 +09:00
committed by GitHub
parent abcea1a14d
commit 17bb575002
11 changed files with 163 additions and 93 deletions

View File

@@ -52,8 +52,10 @@ type base struct {
osPackages
LibraryScanners []models.LibraryScanner
WordPress *models.WordPressPackages
log *logrus.Entry
errs []error
log *logrus.Entry
errs []error
warns []error
}
func (l *base) exec(cmd string, sudo bool) execResult {
@@ -403,9 +405,12 @@ func (l *base) convertToModel() models.ScanResult {
Tag: l.ServerInfo.Image.Tag,
}
errs := []string{}
errs, warns := []string{}, []string{}
for _, e := range l.errs {
errs = append(errs, fmt.Sprintf("%s", e))
errs = append(errs, fmt.Sprintf("%+v", e))
}
for _, w := range l.warns {
warns = append(warns, fmt.Sprintf("%+v", w))
}
scannedVia := scannedViaRemote
@@ -436,6 +441,7 @@ func (l *base) convertToModel() models.ScanResult {
LibraryScanners: l.LibraryScanners,
Optional: l.ServerInfo.Optional,
Errors: errs,
Warnings: warns,
}
}