Module: check_mk
Branch: master
Commit: cabf5f58330624a89c85bfa41fba9b34f2c2c359
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cabf5f58330624…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Oct 2 15:57:55 2018 +0200
Revert "6737 FIX docker_node_network: Wrong API implementation caused a lot of small
inventory historie files"
This reverts commit ac63a6977cad4b27e12d25ea28ebf52976d086d3.
---
.werks/6737 | 10 ----------
inventory/docker_node_network | 25 ++++++++++++-------------
2 files changed, 12 insertions(+), 23 deletions(-)
diff --git a/.werks/6737 b/.werks/6737
deleted file mode 100644
index aa274ce..0000000
--- a/.werks/6737
+++ /dev/null
@@ -1,10 +0,0 @@
-Title: docker_node_network: Wrong API implementation caused a lot of small inventory
historie files
-Level: 1
-Component: inv
-Compatible: compat
-Edition: cre
-Version: 1.6.0i1
-Date: 1538487487
-Class: fix
-
-
diff --git a/inventory/docker_node_network b/inventory/docker_node_network
index 71d1805..fe610d4 100644
--- a/inventory/docker_node_network
+++ b/inventory/docker_node_network
@@ -32,6 +32,10 @@ def _parse_docker_node_network(info):
def inv_docker_node_network_networks(info, inventory_tree, status_data_tree):
parsed = _parse_docker_node_network(info)
+
+ inventory_networks =
inventory_tree.get_dict("software.applications.docker.networks.")
+ status_networks =
status_data_tree.get_dict("software.applications.docker.networks.")
+
for network in parsed:
labels = sorted(["%s: %s" % (k,v) for k,v in
network.get("Labels", {}).items()])
@@ -45,25 +49,20 @@ def inv_docker_node_network_networks(info, inventory_tree,
status_data_tree):
"mac_address" : container["MacAddress"],
})
- network_name = network["Name"]
- path = "software.applications.docker.networks.%s." % network_name
- inventory_networks = inventory_tree.get_dict(path)
- status_networks = status_data_tree.get_dict(path)
-
- status_networks.update({
- "name" : network_name,
- "containers" : [{"name": 1}],
- })
+ status_networks[network["Name"]] = {
+ "name" : network["Name"],
+ "containers" : containers,
+ }
- network_ = {
- "name" : network_name,
+ inventory_networks[network["Name"]] = {
+ "name" : network["Name"],
"host_ifname" :
network["Options"]["com.docker.network.bridge.name"],
"network_id" : network["Id"][:12],
"scope" : network["Scope"],
}
+
if labels:
- network_["labels"] = ", ".join(labels)
- inventory_networks.update(network_)
+ inventory_networks[network["Name"]]["labels"] = ",
".join(labels)
inv_info["docker_node_network.networks"] = {