def save(self):
"""Persist the checks to disk"""
try:
logger.debug("Backing up checks")
if os.path.exists(self._db):
shutil.copyfile(self._db, "{}.bak".format(self._db))
except Exception as e:
logger.exception("Failed to backup checks")
return
try:
logger.debug("Saving checks")
with open(self._db, 'w') as f:
f.write(yaml.safe_dump(self._checks,
default_flow_style=False, explicit_start=True))
except:
logger.exception("Failed to save checks")
评论列表
文章目录