예제 #1
0
def backup_dump(db):   
    from toughradius.tools.backup import dumpdb
    from toughradius.tools.config import find_config
    backup_path = app.config.get('database.backup_path','/var/toughradius/data')  
    backup_file = "toughradius_db_%s.json.gz"%utils.gen_backep_id()
    try:
        dumpdb(find_config(),os.path.join(backup_path,backup_file))
        return dict(code=0,msg="backup done!")
    except Exception as err:
        return dict(code=1,msg="backup fail! %s"%(err))
예제 #2
0
def backup_dump(db):
    from toughradius.tools.backup import dumpdb
    from toughradius.tools.config import find_config
    backup_path = app.config.get('database.backup_path',
                                 '/var/toughradius/data')
    backup_file = "toughradius_db_%s.json.gz" % utils.gen_backep_id()
    try:
        dumpdb(find_config(), os.path.join(backup_path, backup_file))
        return dict(code=0, msg="backup done!")
    except Exception as err:
        return dict(code=1, msg="backup fail! %s" % (err))
예제 #3
0
def backup_restore(db):   
    from toughradius.tools.backup import dumpdb,restoredb
    from toughradius.tools.config import find_config
    backup_path = app.config.get('database.backup_path','/var/toughradius/data')  
    backup_file = "toughradius_db_%s.before_restore.json.gz"%utils.gen_backep_id()
    rebakfs = request.params.get("bakfs")
    try:
        dumpdb(find_config(),os.path.join(backup_path,backup_file))
        restoredb(find_config(),os.path.join(backup_path,rebakfs))
        return dict(code=0,msg="restore done!")
    except Exception as err:
        return dict(code=1,msg="restore fail! %s"%(err)) 
예제 #4
0
def backup_restore(db):
    from toughradius.tools.backup import dumpdb, restoredb
    from toughradius.tools.config import find_config
    backup_path = app.config.get('database.backup_path',
                                 '/var/toughradius/data')
    backup_file = "toughradius_db_%s.before_restore.json.gz" % utils.gen_backep_id(
    )
    rebakfs = request.params.get("bakfs")
    try:
        dumpdb(find_config(), os.path.join(backup_path, backup_file))
        restoredb(find_config(), os.path.join(backup_path, rebakfs))
        return dict(code=0, msg="restore done!")
    except Exception as err:
        return dict(code=1, msg="restore fail! %s" % (err))