Skip to content

fix(scanner): output all results even if all fail #1866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ func ParseInstalledPkgs(distro config.Distro, kernel models.Kernel, pkgList stri
// initServers detect the kind of OS distribution of target servers
func (s Scanner) initServers() error {
hosts, errHosts := s.detectServerOSes()
if len(hosts) == 0 {
return xerrors.New("No scannable host OS")
if (len(hosts) + len(errHosts)) == 0 {
return xerrors.New("No host defined. Check the configuration")
}

for _, srv := range hosts {
Expand All @@ -318,8 +318,8 @@ func (s Scanner) initServers() error {
servers = append(servers, containers...)
errServers = append(errHosts, errContainers...)

if len(servers) == 0 {
return xerrors.New("No scannable servers")
if (len(servers) + len(errServers)) == 0 {
return xerrors.New("No server defined. Check the configuration")
}
return nil
}
Expand Down Expand Up @@ -896,7 +896,7 @@ func (s Scanner) detectIPS() {

// execScan scan
func (s Scanner) execScan() error {
if len(servers) == 0 {
if (len(servers) + len(errServers)) == 0 {
return xerrors.New("No server defined. Check the configuration")
}

Expand Down