Bug: Avoid inventory crash on RHEL7 docker nodes

Hi,

The HW/SW Inventory for docker crashes with ‘NoneType object is not iterable’ when inventorizing RHEL7 Docker nodes (RedHat’s docker package v1.13). This is because docker.info() contains " ‘Labels’ : None " instead of " ‘Labels’: [] ". Inventory data is not shown in the docker nodes view.

After applying the quick&dirty fix below, The inventory completes successfully and I get the Version/Containers/Running/Paused/Stopped values in the view.

Kind regards,
Geoffroy

FIX:

I copied and modified local/lib/python3/cmk/base/plugins/agent_based/docker_node_info.py like this:

-    for label in section.get("Labels", []):
-        yield TableRow(

(…)

+    labels = section.get("Labels", [])
+    if labels is not None:
+        for label in labels:
+            yield TableRow(

(…)