Skip to content

Commit

Permalink
fix(scanner): output all results even if all fail (#1866)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaineK00n authored Mar 7, 2024
1 parent be7b911 commit b8320c0
Showing 1 changed file with 5 additions and 5 deletions.
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

0 comments on commit b8320c0

Please sign in to comment.