From ab124bfb3578ab6df5fd26bd4a7c008f2fa3487c Mon Sep 17 00:00:00 2001 From: strima Date: Fri, 13 Nov 2015 15:38:39 +0100 Subject: [PATCH] fix flatten_dictionary to work with ceph infernalis since at least ceph infernalis the dumped structure looks like this excerpt: u'mds_epoch': {u'nick': u'', u'type': 2, u'description': u'Current epoch of MDS map'}, w/o this fix you get e.g. a path of [(['cluster','mds_epoch','description'],'Current epoch of MDS map')] instead of the assumed [(['cluster','mds_epoch','type'],2)] --- src/collectors/ceph/ceph.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/collectors/ceph/ceph.py b/src/collectors/ceph/ceph.py index b1e38f875..662d53731 100644 --- a/src/collectors/ceph/ceph.py +++ b/src/collectors/ceph/ceph.py @@ -47,10 +47,13 @@ def flatten_dictionary(input_dict, path=None): [([a,b], 10), ([c], 20)] """ + donotInclude = ['nick','description'] if path is None: path = [] for name, value in sorted(input_dict.items()): + if name in donotInclude: + continue path.append(name) if isinstance(value, dict): for result in flatten_dictionary(value, path):