From 3428eab79ab21d1ecee6d2f8edff083a2cccdf79 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 24 Sep 2012 13:25:01 -0400 Subject: made json optional again --- src/lib/Bcfg2/Server/Plugins/Probes.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Probes.py') diff --git a/src/lib/Bcfg2/Server/Plugins/Probes.py b/src/lib/Bcfg2/Server/Plugins/Probes.py index 9e6b43d7b..58723e392 100644 --- a/src/lib/Bcfg2/Server/Plugins/Probes.py +++ b/src/lib/Bcfg2/Server/Plugins/Probes.py @@ -9,7 +9,6 @@ import operator import lxml.etree import Bcfg2.Server import Bcfg2.Server.Plugin -from Bcfg2.Compat import json # pylint: disable=F0401 try: @@ -31,6 +30,16 @@ try: except ImportError: pass +try: + import json + HAS_JSON = True +except ImportError: + try: + import simplejson as json + HAS_JSON = True + except ImportError: + HAS_JSON = False + try: import syck as yaml import syck.error as YAMLError @@ -89,7 +98,7 @@ class ProbeData(str): @property def json(self): """ The probe data as a decoded JSON data structure """ - if self._json is None: + if self._json is None and HAS_JSON: try: self._json = json.loads(self.data) except ValueError: -- cgit v1.2.3-1-g7c22