From: Ilya Date: Sat, 18 Feb 2017 05:52:39 +0000 (+0900) Subject: python.d.plugin: OrderedDict import for python2.6 added X-Git-Tag: ab-debian_0.20170221.01-0ab1~1^2~1^2 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netdata.git;a=commitdiff_plain;h=33bdf00775ccafd6de5f208c74c78104e9fd7859 python.d.plugin: OrderedDict import for python2.6 added --- 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