Пример #1
0
 def post(self):
     backup_path = self.settings.config.database.backup_path
     backup_file = "toughwlan_db_%s.json.gz" % utils.gen_backep_id()
     try:
         dumpdb(self.settings.config, os.path.join(backup_path, backup_file))
         return self.render_json(code=0, msg="backup done!")
     except Exception as err:
         log.err()
         return self.render_json(code=1, msg="backup fail! %s" % (err))
Пример #2
0
 def post(self):
     backup_path = self.settings.config.database.backup_path
     backup_file = "toughwlan_db_%s.before_restore.json.gz" % utils.gen_backep_id()
     rebakfs = self.get_argument("bakfs")
     try:
         dumpdb(self.settings.config, os.path.join(backup_path, backup_file))
         restoredb(self.settings.config, os.path.join(backup_path, rebakfs))
         return self.render_json(code=0, msg="restore done!")
     except Exception as err:
         return self.render_json(code=1, msg="restore fail! %s" % (err))