Module: check_mk
Branch: master
Commit: ed782b3400f8195953d9ad19a04498b05a9335e6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ed782b3400f819…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Jul 14 11:22:43 2016 +0200
WK3557: Web API: get_host/get_all_hosts action now also returns the nodes of cluster host
---
.werks/3557 | 9 +++++++++
ChangeLog | 1 +
web/plugins/webapi/webapi.py | 7 ++++++-
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/.werks/3557 b/.werks/3557
new file mode 100644
index 0000000..195fa89
--- /dev/null
+++ b/.werks/3557
@@ -0,0 +1,9 @@
+Title: Web API: get_host/get_all_hosts action now also returns the nodes of cluster host
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.4.0i1
+Date: 1468487596
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index afaaf7a..e8e9d8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -490,6 +490,7 @@
* 3547 FIX: Deleting a subfolder now generates a correct audit message...
* 3661 FIX: Service discovery is now possible with only "modify services"
permission...
* 3152 FIX: lvm_vgs: fixed exception in host-specific settings if rule for LVM groups
is set
+ * 3557 FIX: Web API: get_host/get_all_hosts action now also returns the nodes of
cluster host
Notifications:
* 3263 Notifications: allow users to restrict by their contact groups...
diff --git a/web/plugins/webapi/webapi.py b/web/plugins/webapi/webapi.py
index 19c952a..1684438 100644
--- a/web/plugins/webapi/webapi.py
+++ b/web/plugins/webapi/webapi.py
@@ -175,7 +175,10 @@ def action_get_host(request):
else:
attributes = host.attributes()
- return { "attributes": attributes, "path": host.folder().path(),
"hostname": host.name() }
+ response = { "attributes": attributes, "path":
host.folder().path(), "hostname": host.name() }
+ if host.is_cluster():
+ response["nodes"] = host.cluster_nodes()
+ return response
api_actions["get_host"] = {
"handler" : action_get_host,
@@ -200,6 +203,8 @@ def action_get_all_hosts(request):
else:
attributes = host.attributes()
response[hostname] = { "attributes": attributes, "path":
host.folder().path(), "hostname": host.name() }
+ if host.is_cluster():
+ response[hostname]["nodes"] = host.cluster_nodes()
return response