self._display.warning("error while trying to read %s : %s. Most likely a corrupt file, so erasing and failing."%(cachefile,to_bytes(e)))
self.delete(key)
raiseAnsibleError("The JSON cache file %s was corrupt, or did not otherwise contain valid JSON data. It has been removed, so you can re-run your command now."%cachefile)
except(OSError,IOError)ase:
self._display.warning("error while trying to read %s : %s"%(cachefile,to_bytes(e)))
pass
else:
try:
value=json.load(f)
self._cache[key]=value
returnvalue
exceptValueErrorase:
self._display.warning("error while trying to read %s : %s. Most likely a corrupt file, so erasing and failing."%(cachefile,to_bytes(e)))
self.delete(key)
raiseAnsibleError("The JSON cache file %s was corrupt, or did not otherwise contain valid JSON data. It has been removed, so you can re-run your command now."%cachefile)