Esempio n. 1
0
def test_config():
    try:
        SourceAct(**request.form).test_config()
        msg = 'Database successfully connected'
        return resp_format.from_dict(resp_format.MSG_OK, msg=msg)
    except Exception, e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
Esempio n. 2
0
def test_config():
    try:
        DestinationAct(**request.form).test_config()
        msg = 'FTP connection successfully tested'
        return resp_format.from_dict(resp_format.MSG_OK, msg=msg)
    except Error.TestConfigException as e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
Esempio n. 3
0
def test_config():
    try:
        SourceAct(**request.form).test_config()
        msg = 'Directory exists and accessible'
        return resp_format.from_dict(resp_format.MSG_OK, msg=msg)
    except Error.TestConfigException as e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
Esempio n. 4
0
def test_config():
    try:
        SourceAct(**request.form).test_config()
        msg = 'Directory exists and accessible'
        return resp_format.from_dict(resp_format.MSG_OK, msg=msg)
    except Error.TestConfigException as e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
Esempio n. 5
0
def test_config():
    try:
        DestinationAct(**request.form).test_config()
        msg = 'FTP connection successfully tested'
        return resp_format.from_dict(resp_format.MSG_OK, msg=msg)
    except Error.TestConfigException as e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
Esempio n. 6
0
def profile():
    if request.method == 'GET':
        return profile_list()

    try:
        s = {}
        d = {}
        o = {}
        for k, v in request.form.iteritems():
            if k.startswith('src_'):
                s[k] = v
            elif k.startswith('dst_'):
                d[k] = v
            elif k.startswith('opt_'):
                o[k] = v

        p_id = Profile().create(s, d, o)
        schedule_job(p_id)

        return resp_format.from_dict(resp_format.MSG_OK,
                                     msg='Profile successfully created')
    except Error.ProfileException as e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
    except Error.TestConfigException as e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
Esempio n. 7
0
def log_action():
    act = request.args.get('act')
    try:
        if act == 'delete':
            Eventlog().remove_all(current_user.id)
            return resp_format.from_dict(resp_format.MSG_OK, msg='Log has been deleted')
    except Exception, e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
Esempio n. 8
0
def log_action():
    act = request.args.get('act')
    try:
        if act == 'delete':
            Eventlog().remove_all(current_user.id)
            return resp_format.from_dict(resp_format.MSG_OK,
                                         msg='Log has been deleted')
    except Exception, e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
Esempio n. 9
0
def profil_actions():
    act = request.args.get('act')
    p_id = request.args.get('p_id')
    try:
        if act == 'active':
            schedule_job(p_id)
            return resp_format.from_dict(resp_format.MSG_OK,
                                         msg='Profile successfully activated')
        elif act == 'pause':
            unschedule_job(p_id)
            return resp_format.from_dict(resp_format.MSG_OK,
                                         msg='Profile successfully paused')
        elif act == 'delete':
            unschedule_job(p_id)
            Profile().delete_by_pk(p_id)
            return resp_format.from_dict(resp_format.MSG_OK,
                                         msg='Profile hase been deleted')
        elif act == 'run':
            profile_execute(p_id)
            return resp_format.from_dict(resp_format.MSG_OK,
                                         msg='Job completed successfully')

    except Error.ProfileException as e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
    except Exception, e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
Esempio n. 10
0
def profile():
    if request.method == 'GET':
        return profile_list()
    
    try:
        s = {}; d = {}; o = {}
        for k, v in request.form.iteritems():
            if k.startswith('src_'):
                s[k] = v
            elif k.startswith('dst_'):
                d[k] = v
            elif k.startswith('opt_'):
                o[k] = v

        p_id = Profile().create(s, d, o)
        schedule_job(p_id)
        
        return resp_format.from_dict(resp_format.MSG_OK, msg='Profile successfully created')
    except Error.ProfileException as e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
    except Error.TestConfigException as e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
Esempio n. 11
0
def profil_actions():
    act = request.args.get('act')
    p_id = request.args.get('p_id')
    try:
        if act == 'active':
            schedule_job(p_id)
            return resp_format.from_dict(resp_format.MSG_OK, msg='Profile successfully activated')
        elif act == 'pause':
            unschedule_job(p_id)
            return resp_format.from_dict(resp_format.MSG_OK, msg='Profile successfully paused')
        elif act == 'delete':
            unschedule_job(p_id)
            Profile().delete_by_pk(p_id)
            return resp_format.from_dict(resp_format.MSG_OK, msg='Profile hase been deleted')
        elif act == 'run':
            profile_execute(p_id)
            return resp_format.from_dict(resp_format.MSG_OK, msg='Job completed successfully')
        
    except Error.ProfileException as e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))
    except Exception, e:
        return resp_format.from_dict(resp_format.MSG_FAIL, msg=str(e))