Show error when no scannable servers are detected.

This commit is contained in:
Kota Kanbe
2016-09-14 09:35:15 +09:00
parent 1b85e56961
commit f5eeed0bc2
4 changed files with 17 additions and 5 deletions

View File

@@ -170,11 +170,15 @@ func PrintSSHableServerNames() {
}
// InitServers detect the kind of OS distribution of target servers
func InitServers(localLogger *logrus.Entry) {
func InitServers(localLogger *logrus.Entry) error {
Log = localLogger
servers = detectServerOSes()
if len(servers) == 0 {
return fmt.Errorf("No scannable servers")
}
containers := detectContainerOSes()
servers = append(servers, containers...)
return nil
}
func detectServerOSes() (sshAbleOses []osTypeInterface) {