|
|
|
@ -17,14 +17,12 @@
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
import time
|
|
|
|
|
import json
|
|
|
|
|
import errno
|
|
|
|
|
|
|
|
|
|
from ansible import constants as C
|
|
|
|
|
from ansible import utils
|
|
|
|
|
from ansible.cache.base import BaseCacheModule
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CacheModule(BaseCacheModule):
|
|
|
|
|
"""
|
|
|
|
|
A caching module backed by json files.
|
|
|
|
@ -70,12 +68,11 @@ class CacheModule(BaseCacheModule):
|
|
|
|
|
|
|
|
|
|
cachefile = "%s/%s" % (self._cache_dir, key)
|
|
|
|
|
try:
|
|
|
|
|
#TODO: check if valid keys can have invalid FS chars, base32?
|
|
|
|
|
f = open(cachefile, 'w')
|
|
|
|
|
except (OSError,IOError), e:
|
|
|
|
|
utils.warning("error while trying to read %s : %s" % (cachefile, str(e)))
|
|
|
|
|
else:
|
|
|
|
|
json.dump(value, f, ensure_ascii=False)
|
|
|
|
|
f.write(utils.jsonify(value))
|
|
|
|
|
finally:
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|