From 33bdf00775ccafd6de5f208c74c78104e9fd7859 Mon Sep 17 00:00:00 2001 From: Ilya Date: Sat, 18 Feb 2017 14:52:39 +0900 Subject: [PATCH] python.d.plugin: OrderedDict import for python2.6 added --- plugins.d/python.d.plugin | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins.d/python.d.plugin b/plugins.d/python.d.plugin index 126041ab..4fdfae34 100755 --- a/plugins.d/python.d.plugin +++ b/plugins.d/python.d.plugin @@ -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 -- 2.39.2