]> arthur.barton.de Git - netdata.git/commitdiff
python.d.plugin: OrderedDict import for python2.6 added
authorIlya <ilyamaschenko@gmail.com>
Sat, 18 Feb 2017 05:52:39 +0000 (14:52 +0900)
committerIlya <ilyamaschenko@gmail.com>
Sat, 18 Feb 2017 05:52:39 +0000 (14:52 +0900)
plugins.d/python.d.plugin

index 126041ab13a55df1bc6a2b959c42e10e8d200e28..4fdfae34725fb18d0f715ac07c8065fa877cd4ee 100755 (executable)
@@ -73,10 +73,16 @@ try:
     DICT = OrderedDict
     msg.info('YAML output is ordered')
 except ImportError:
-    ORDERED = False
-    DICT = dict
-    msg.info('YAML output is unordered')
-else:
+    try:
+        from ordereddict import OrderedDict
+        ORDERED = True
+        DICT = OrderedDict
+        msg.info('YAML output is ordered')
+    except ImportError:
+        ORDERED = False
+        DICT = dict
+        msg.info('YAML output is unordered')
+if ORDERED:
     def ordered_load(stream, Loader=yaml.Loader, object_pairs_hook=OrderedDict):
         class OrderedLoader(Loader):
             pass