Module: check_mk
Branch: master
Commit: 41770b334e356a95e090923d39c901696dae23dd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=41770b334e356a…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Feb 9 12:11:47 2018 +0100
Revert "Fixed handling of another numeration format"
This reverts commit 48a20ff4676976e5f2166b2aac3df7d54b81f94b.
---
cmk/structured_data.py | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/cmk/structured_data.py b/cmk/structured_data.py
index 52caf71..af36fa2 100644
--- a/cmk/structured_data.py
+++ b/cmk/structured_data.py
@@ -194,15 +194,10 @@ class StructuredDataTree(object):
# In the second case we have to deal with nested numerations
# We take a look at children which may be real numerations
# or sub trees.
- # May also be a flat list, thus we convert to expected
- # numeration format: [{KEY: VAL,..},..]
- entries_type = self._get_entries_type(v)
- if isinstance(entries_type, Numeration):
+ if self._is_numeration(v):
sub_raw_tree.setdefault(k, v)
- elif isinstance(entries_type, Container):
- sub_raw_tree.setdefault(k, dict(enumerate(v)))
else:
- sub_raw_tree.setdefault(k, [{"name": e} for e in v])
+ sub_raw_tree.setdefault(k, dict(enumerate(v)))
else:
# Here we collect all other values meaning simple
# attributes of this node.
@@ -210,15 +205,12 @@ class StructuredDataTree(object):
return sub_raw_tree, leaf_data
- def _get_entries_type(self, entries):
- #TODO test
+ def _is_numeration(self, entries):
for entry in entries:
- if not isinstance(entry, dict):
- return
for k, v in entry.iteritems():
if isinstance(v, list):
- return Container()
- return Numeration()
+ return False
+ return True
# ---delegators-----------------------------------------------------------