summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimmo Koskinen <kimmo.koskinen@solita.fi>2015-04-07 14:26:42 +0300
committerToshio Kuratomi <toshio@fedoraproject.org>2015-04-09 10:41:23 -0700
commit9bd2e3b75218983c57cfec61de261493ab0e5eb5 (patch)
tree7674e34808906ec21f06f973c130d145084b7d58
parent7923a1a2c5354ada079d411da488f563c208b167 (diff)
downloadansible-9bd2e3b75218983c57cfec61de261493ab0e5eb5.tar.gz
Use codecs module while reading & writing json cache file
-rw-r--r--lib/ansible/cache/jsonfile.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/ansible/cache/jsonfile.py b/lib/ansible/cache/jsonfile.py
index b7d72c8d2e..93ee69903b 100644
--- a/lib/ansible/cache/jsonfile.py
+++ b/lib/ansible/cache/jsonfile.py
@@ -18,6 +18,7 @@
import os
import time
import errno
+import codecs
try:
import simplejson as json
@@ -57,7 +58,7 @@ class CacheModule(BaseCacheModule):
cachefile = "%s/%s" % (self._cache_dir, key)
try:
- f = open( cachefile, 'r')
+ f = codecs.open(cachefile, 'r', encoding='utf-8')
except (OSError,IOError), e:
utils.warning("error while trying to write to %s : %s" % (cachefile, str(e)))
else:
@@ -73,7 +74,7 @@ class CacheModule(BaseCacheModule):
cachefile = "%s/%s" % (self._cache_dir, key)
try:
- f = open(cachefile, 'w')
+ f = codecs.open(cachefile, 'w', encoding='utf-8')
except (OSError,IOError), e:
utils.warning("error while trying to read %s : %s" % (cachefile, str(e)))
else: