mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
removed uneeded and posibly error producing json import
now uses utils.jsonify which does proper utf8 encoding
This commit is contained in:
parent
a55c6625d4
commit
ed380136bc
1 changed files with 1 additions and 4 deletions
5
lib/ansible/cache/jsonfile.py
vendored
5
lib/ansible/cache/jsonfile.py
vendored
|
@ -17,14 +17,12 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import json
|
|
||||||
import errno
|
import errno
|
||||||
|
|
||||||
from ansible import constants as C
|
from ansible import constants as C
|
||||||
from ansible import utils
|
from ansible import utils
|
||||||
from ansible.cache.base import BaseCacheModule
|
from ansible.cache.base import BaseCacheModule
|
||||||
|
|
||||||
|
|
||||||
class CacheModule(BaseCacheModule):
|
class CacheModule(BaseCacheModule):
|
||||||
"""
|
"""
|
||||||
A caching module backed by json files.
|
A caching module backed by json files.
|
||||||
|
@ -70,12 +68,11 @@ class CacheModule(BaseCacheModule):
|
||||||
|
|
||||||
cachefile = "%s/%s" % (self._cache_dir, key)
|
cachefile = "%s/%s" % (self._cache_dir, key)
|
||||||
try:
|
try:
|
||||||
#TODO: check if valid keys can have invalid FS chars, base32?
|
|
||||||
f = open(cachefile, 'w')
|
f = open(cachefile, 'w')
|
||||||
except (OSError,IOError), e:
|
except (OSError,IOError), e:
|
||||||
utils.warning("error while trying to read %s : %s" % (cachefile, str(e)))
|
utils.warning("error while trying to read %s : %s" % (cachefile, str(e)))
|
||||||
else:
|
else:
|
||||||
json.dump(value, f, ensure_ascii=False)
|
f.write(utils.jsonify(value))
|
||||||
finally:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue