Ejemplo n.º 1
0
Archivo: api.py Proyecto: rock0528/scm
def restore_schedules(request, host_name, project_name):
    (backup_row, user, password) = get_schedule_backup_info(host_name, project_name)
    ec = ecSchedules(user, password, server=host_name)
    for row in EC_Schedule.objects.filter(backup=backup_row):
        ec.enableSchedule(project_name, row.schedule_name, row.schedule_enable)
    backup_row.is_restore=True
    backup_row.save()
    return get_schedules(request, host_name, project_name)
Ejemplo n.º 2
0
Archivo: api.py Proyecto: rock0528/scm
def restore_schedules(request, host_name, project_name):
    (backup_row, user,
     password) = get_schedule_backup_info(host_name, project_name)
    ec = ecSchedules(user, password, server=host_name)
    for row in EC_Schedule.objects.filter(backup=backup_row):
        ec.enableSchedule(project_name, row.schedule_name, row.schedule_enable)
    backup_row.is_restore = True
    backup_row.save()
    return get_schedules(request, host_name, project_name)
Ejemplo n.º 3
0
Archivo: api.py Proyecto: rock0528/scm
def backup_schedules(request, host_name, project_name):
    (backup_row, user, password) = get_schedule_backup_info(host_name, project_name, is_create_backup=True)
    EC_Schedule.objects.filter(backup=backup_row).delete()
    ec = ecSchedules(user, password, server=host_name)
    for name, state in ec.getSchedulesState(project_name).items():
        record = EC_Schedule(   backup=backup_row,
                                schedule_name=name,
                                schedule_enable=state
                                )
        record.save()
        if state == 'true':
            ec.enableSchedule(project_name, name, 'false')
    backup_row.backup_time=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    backup_row.is_restore=False
    backup_row.save()
    return get_schedules(request, host_name, project_name)
Ejemplo n.º 4
0
Archivo: api.py Proyecto: rock0528/scm
def backup_schedules(request, host_name, project_name):
    (backup_row, user,
     password) = get_schedule_backup_info(host_name,
                                          project_name,
                                          is_create_backup=True)
    EC_Schedule.objects.filter(backup=backup_row).delete()
    ec = ecSchedules(user, password, server=host_name)
    for name, state in ec.getSchedulesState(project_name).items():
        record = EC_Schedule(backup=backup_row,
                             schedule_name=name,
                             schedule_enable=state)
        record.save()
        if state == 'true':
            ec.enableSchedule(project_name, name, 'false')
    backup_row.backup_time = datetime.datetime.now().strftime(
        '%Y-%m-%d %H:%M:%S')
    backup_row.is_restore = False
    backup_row.save()
    return get_schedules(request, host_name, project_name)