summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2014-12-23 13:14:14 -0800
committerJames Cammarata <jimi@sngx.net>2015-02-17 13:39:55 -0600
commita16d0a8dd6db6be90b01fae0e17bc00d6d3aca60 (patch)
treee66b482467dbb7b67916cfcb395d0499629417fb
parentbf656e35e0cd191a75b5722cabb378149cd29d1c (diff)
downloadansible-a16d0a8dd6db6be90b01fae0e17bc00d6d3aca60.tar.gz
Restore json import for redis as well. Switch preference to simplejson for speed
-rw-r--r--lib/ansible/cache/jsonfile.py4
-rw-r--r--lib/ansible/cache/redis.py5
-rw-r--r--lib/ansible/utils/__init__.py6
3 files changed, 10 insertions, 5 deletions
diff --git a/lib/ansible/cache/jsonfile.py b/lib/ansible/cache/jsonfile.py
index 3e037e414a..cedbaa49b7 100644
--- a/lib/ansible/cache/jsonfile.py
+++ b/lib/ansible/cache/jsonfile.py
@@ -21,9 +21,9 @@ import json
import errno
try:
- import json
-except ImportError:
import simplejson as json
+except ImportError:
+ import json
from ansible import constants as C
from ansible import utils
diff --git a/lib/ansible/cache/redis.py b/lib/ansible/cache/redis.py
index 776c6c7f80..7ae5ef74c1 100644
--- a/lib/ansible/cache/redis.py
+++ b/lib/ansible/cache/redis.py
@@ -21,6 +21,11 @@ import collections
import sys
import time
+try:
+ import simplejson as json
+except ImportError:
+ import json
+
from ansible import constants as C
from ansible.utils import jsonify
from ansible.cache.base import BaseCacheModule
diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py
index a735e9c0b0..44db63e276 100644
--- a/lib/ansible/utils/__init__.py
+++ b/lib/ansible/utils/__init__.py
@@ -45,7 +45,6 @@ import warnings
import traceback
import getpass
import sys
-import json
import subprocess
import contextlib
@@ -63,9 +62,10 @@ CODE_REGEX = re.compile(r'(?:{%|%})')
try:
- import json
-except ImportError:
+ # simplejson can be much faster if it's available
import simplejson as json
+except ImportError:
+ import json
# Note, sha1 is the only hash algorithm compatible with python2.4 and with
# FIPS-140 mode (as of 11-2014)