Module: check_mk
Branch: master
Commit: 83bfa3f76f0e09c453415514e816413cba8254d4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=83bfa3f76f0e09…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 18 16:16:18 2016 +0100
network scan: Fixed issues in distributed setups
---
web/htdocs/wato.py | 7 +++++--
web/htdocs/watolib.py | 8 +++++---
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index b6cd160..97e8c69 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -15006,9 +15006,12 @@ def execute_network_scan_job():
if config.site_is_local(folder.site_id()):
found = do_network_scan(folder)
else:
- found = do_remote_automation(folder.site_id(), "network-scan",
+ found = do_remote_automation(config.site(folder.site_id()),
"network-scan",
[("folder", folder.path())])
+ if not type(found) == list:
+ raise MKGeneralException(_("Received an invalid network scan result:
%r") % found)
+
add_scanned_hosts_to_folder(folder, found)
result.update({
@@ -15201,7 +15204,7 @@ def scan_ip_addresses(folder, ip_addresses):
num_addresses = len(ip_addresses)
# dont start more threads than needed
- parallel_pings =
min(folder.attribute("network_scan")["max_parallel_pings"],
num_addresses)
+ parallel_pings =
min(folder.attribute("network_scan").get("max_parallel_pings", 100),
num_addresses)
# Initalize all workers
threads = []
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index d47c4e9..5467a66 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -3101,14 +3101,16 @@ def do_remote_automation(site, command, vars):
vars_encoded = html.urlencode_vars(vars)
response = get_url(url, site.get('insecure', False),
post_data=vars_encoded)
+
if not response:
raise MKAutomationException("Empty output from remote site.")
+
try:
response = eval(response)
except:
- # The remote site will send non-Python data in case of an
- # error.
+ # The remote site will send non-Python data in case of an error.
raise MKAutomationException("<pre>%s</pre>" % response)
+
return response
@@ -3127,7 +3129,7 @@ def is_distributed(sites = None):
def is_wato_slave_site():
- return has_distributed_wato_file()
+ return has_distributed_wato_file() and not has_wato_slave_sites()
def has_wato_slave_sites():