Exemple #1
0
 def post(self):
     backup_path = self.settings.config.database.backup_path
     backup_file = "toughradius_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:
         return self.render_json(code=1, msg="backup fail! %s" % (err))
Exemple #2
0
 def post(self):
     backup_path = self.settings.config.database.backup_path
     backup_file = "toughradius_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))