Add support for multiple inputs to nmap tracking module as a list (#3944)

pull/3962/head
hcooper 2016-10-19 22:15:00 -07:00 committed by Johann Kellerman
parent 081e61528d
commit d60c2d604f
1 changed files with 3 additions and 2 deletions

View File

@ -30,7 +30,7 @@ CONF_EXCLUDE = 'exclude'
REQUIREMENTS = ['python-nmap==0.6.1']
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_HOSTS): cv.string,
vol.Required(CONF_HOSTS): cv.ensure_list,
vol.Required(CONF_HOME_INTERVAL, default=0): cv.positive_int,
vol.Optional(CONF_EXCLUDE, default=[]):
vol.All(cv.ensure_list, vol.Length(min=1))
@ -120,7 +120,8 @@ class NmapDeviceScanner(object):
options += ' --exclude {}'.format(','.join(exclude_hosts))
try:
result = scanner.scan(hosts=self.hosts, arguments=options)
result = scanner.scan(hosts=' '.join(self.hosts),
arguments=options)
except PortScannerError:
return False