Module: check_mk
Branch: master
Commit: a004d276d3427568be5333bf1c9205ed6c4b1a4d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a004d276d34275…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Oct 6 15:35:33 2016 +0200
3820 FIX Network scan: no longer fails completely if hostname already exists in
configuration
Already known hostnames are now skipped instead.
---
.werks/3820 | 11 +++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 5 ++---
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/.werks/3820 b/.werks/3820
new file mode 100644
index 0000000..1564baf
--- /dev/null
+++ b/.werks/3820
@@ -0,0 +1,11 @@
+Title: Network scan: no longer fails completely if hostname already exists in
configuration
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i2
+Date: 1475760893
+
+Already known hostnames are now skipped instead.
+
diff --git a/ChangeLog b/ChangeLog
index 4a66614..f657cb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,7 @@
WATO:
* 3915 User access times: New icon when never logged in; New column "last
seen"
* 3914 FIX: Roles: Aliases are now unique during cloning
+ * 3820 FIX: Network scan: no longer fails completely if hostname already exists in
configuration...
Livestatus:
* 3740 Moved livedump utility from treasures directly into bin directory...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index c14c68c..14dc9f2 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -15914,8 +15914,6 @@ def do_network_scan_automation():
automation_commands["network-scan"] = do_network_scan_automation
-
-# FIXME/TODO: What happens in case of duplicate host names?
def add_scanned_hosts_to_folder(folder, found):
translation =
folder.attribute("network_scan").get("translate_names", {})
@@ -15927,7 +15925,8 @@ def add_scanned_hosts_to_folder(folder, found):
"ipaddress" : ipaddress,
"tag_criticality" : "offline",
}
- entries.append((host_name, attrs, None))
+ if not Host.host_exists(host_name):
+ entries.append((host_name, attrs, None))
lock_exclusive()
folder.create_hosts(entries)