summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2014-01-29 07:43:06 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2014-01-29 16:34:18 -0500
commit2defc9cf5155f21a988855c31049fad3e40ecdd1 (patch)
treef84db01dae7eb23a8d34a4022a80e00f39b104d7
parent79f5fce2a387f5dfc13e10146b36cb620a5bf166 (diff)
downloadbcfg2-2defc9cf5155f21a988855c31049fad3e40ecdd1.tar.gz
bcfg2-2defc9cf5155f21a988855c31049fad3e40ecdd1.tar.bz2
bcfg2-2defc9cf5155f21a988855c31049fad3e40ecdd1.zip
load correct JSON library on py2.4
-rw-r--r--src/lib/Bcfg2/Server/Lint/ValidateJSON.py3
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Ohai.py3
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Yum.py3
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Probes.py3
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Properties.py3
-rwxr-xr-xsrc/sbin/bcfg2-yum-helper3
6 files changed, 12 insertions, 6 deletions
diff --git a/src/lib/Bcfg2/Server/Lint/ValidateJSON.py b/src/lib/Bcfg2/Server/Lint/ValidateJSON.py
index c4a82a5d2..31bbadeb2 100644
--- a/src/lib/Bcfg2/Server/Lint/ValidateJSON.py
+++ b/src/lib/Bcfg2/Server/Lint/ValidateJSON.py
@@ -10,7 +10,8 @@ import Bcfg2.Server.Lint
try:
import json
-except ImportError:
+ json.loads # py2.4 json library is structured differently
+except (ImportError, AttributeError):
import simplejson as json
diff --git a/src/lib/Bcfg2/Server/Plugins/Ohai.py b/src/lib/Bcfg2/Server/Plugins/Ohai.py
index 1ec3cbd60..f5bde1820 100644
--- a/src/lib/Bcfg2/Server/Plugins/Ohai.py
+++ b/src/lib/Bcfg2/Server/Plugins/Ohai.py
@@ -10,7 +10,8 @@ import Bcfg2.Server.Plugin
try:
import json
-except ImportError:
+ json.loads # py2.4 json library is structured differently
+except (ImportError, AttributeError):
import simplejson as json
PROBECODE = """#!/bin/sh
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
index 66f8e9dbe..43a54471c 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
@@ -87,7 +87,8 @@ try:
import yum
try:
import json
- except ImportError:
+ json.loads # py2.4 json library is structured differently
+ except (ImportError, AttributeError):
import simplejson as json
HAS_YUM = True
except ImportError:
diff --git a/src/lib/Bcfg2/Server/Plugins/Probes.py b/src/lib/Bcfg2/Server/Plugins/Probes.py
index fdc047283..471ebfdaf 100644
--- a/src/lib/Bcfg2/Server/Plugins/Probes.py
+++ b/src/lib/Bcfg2/Server/Plugins/Probes.py
@@ -34,8 +34,9 @@ except ImportError:
try:
import json
+ json.loads # py2.4 json library is structured differently
HAS_JSON = True
-except ImportError:
+except (ImportError, AttributeError):
try:
import simplejson as json
HAS_JSON = True
diff --git a/src/lib/Bcfg2/Server/Plugins/Properties.py b/src/lib/Bcfg2/Server/Plugins/Properties.py
index 89f2d21ff..b6090c4d1 100644
--- a/src/lib/Bcfg2/Server/Plugins/Properties.py
+++ b/src/lib/Bcfg2/Server/Plugins/Properties.py
@@ -17,8 +17,9 @@ except ImportError:
try:
import json
+ json.loads # py2.4 json library is structured differently
HAS_JSON = True
-except ImportError:
+except (ImportError, AttributeError):
try:
import simplejson as json
HAS_JSON = True
diff --git a/src/sbin/bcfg2-yum-helper b/src/sbin/bcfg2-yum-helper
index 49baeb9c3..132f9efce 100755
--- a/src/sbin/bcfg2-yum-helper
+++ b/src/sbin/bcfg2-yum-helper
@@ -15,7 +15,8 @@ from lockfile import FileLock, LockTimeout
from optparse import OptionParser
try:
import json
-except ImportError:
+ json.loads # py2.4 json library is structured differently
+except (ImportError, AttributeError):
import simplejson as json