summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/Probes.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-09-24 13:25:01 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-09-25 11:58:48 -0400
commit3428eab79ab21d1ecee6d2f8edff083a2cccdf79 (patch)
tree9f19144fe7d5161c9208f50aa0b6a9945682a967 /src/lib/Bcfg2/Server/Plugins/Probes.py
parent6d4d8df68717780239fad273dd722359db10e64b (diff)
downloadbcfg2-3428eab79ab21d1ecee6d2f8edff083a2cccdf79.tar.gz
bcfg2-3428eab79ab21d1ecee6d2f8edff083a2cccdf79.tar.bz2
bcfg2-3428eab79ab21d1ecee6d2f8edff083a2cccdf79.zip
made json optional again
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Probes.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Probes.py13
1 files changed, 11 insertions, 2 deletions
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:
@@ -32,6 +31,16 @@ 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
HAS_YAML = True
@@ -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: