コード例 #1
0
ファイル: home.py プロジェクト: wangwuli/XLauto
def home_menu_query():
    sys_menu = db.session.query(SysMenu.id, SysMenu.parent_id, SysMenu.name,
                                SysMenu.icon, SysMenu.title).all()
    db.session.close()
    db.session.remove()
    sys_menu_data = model_to_dict(sys_menu)

    data = list_to_tree(sys_menu_data)

    return Result.success_response(data, '菜单加载成功')
コード例 #2
0
def system_action_query():
    system_action = request.args.get('system_action')

    sys_code_data = db.session.query(SystemFunction.system_function_id, SystemFunction.system_action_name).filter(
        SystemFunction.system_action == system_action).all()
    db.session.close()
    db.session.remove()
    data = model_to_dict(sys_code_data)

    return Result.success_response(data,'类型查询成功')
コード例 #3
0
def code_query():
    code_type = request.args.get('code_type')

    sys_code_data = db.session.query(SysCode.code_id, SysCode.code_key, SysCode.code_name).filter(
        SysCode.code_type == code_type).all()
    db.session.close()
    db.session.remove()
    data = model_to_dict(sys_code_data)

    return Result.success_response(data,'类型查询成功')
コード例 #4
0
ファイル: home.py プロジェクト: wangwuli/XLauto
def home_projects_query():
    project_obj = db.session.query(
        Project.project_id,
        Project.project_name,
        Project.project_code,
        Project.controller_ip,
        Project.order_id,
        Project.comments,
    ).all()
    db.session.close()
    db.session.remove()
    project_data = model_to_dict(project_obj, onedict=False)
    return Result.success_response(project_data, '项目查询成功')
コード例 #5
0
ファイル: auxiliary.py プロジェクト: wangwuli/XLauto
def query_execute_batch_status(script_execute_event_batch_id):
    """
    查询批次状态
    :param script_execute_event_batch_id:
    :return:
    """
    sys_code_data = db.session.query(
        ScriptFileExecuteEvent.script_file_id,
        ScriptFileExecuteEvent.execute_result,
        ScriptFileExecuteEvent.script_file_content,
        ScriptFileExecuteEvent.host_id).filter(
            ScriptFileExecuteEvent.script_execute_event_batch_id ==
            script_execute_event_batch_id).all()
    db.session.close()
    db.session.remove()
    data = model_to_dict(sys_code_data)

    return data
コード例 #6
0
def query_portal_label_info(portal_label):
    """
    配置内容查询
    :param portal_label:
    :return:
    """
    sys_code_data = db.session.query(
        SystemOtherPortal.system_other_portals_id,
        SystemOtherPortal.portal_name, SystemOtherPortal.portal_url,
        SystemOtherPortal.portal_login_user,
        SystemOtherPortal.portal_login_pwd,
        SystemOtherPortal.portal_disabled).filter(
            SystemOtherPortal.portal_label == portal_label).all()
    db.session.close()
    db.session.remove()
    data = model_to_dict(sys_code_data)

    return data
コード例 #7
0
ファイル: hosts_operation.py プロジェクト: wangwuli/XLauto
def host_action_execute(host_user_infos,
                        system_function_ids,
                        replace_parameters=''):
    """
    执行具体命令表ID动作
    :param host_id:
    :param system_function_id: system_function.system_function_id
    :return:
    """

    system_function_info = db.session.query(
        SystemFunction.system_function_id,
        SystemFunction.function_type,
        SystemFunction.system_content,
        SystemFunction.system_content_file,
        SystemFunction.action_service_switch,
    ).order_by(db.desc(SystemFunction.order_by)).filter(
        SystemFunction.system_function_id.in_(system_function_ids)).all()
    db.session.commit()
    db.session.close()
    db.session.remove()

    system_function_info = model_to_dict(system_function_info)
    # system_function_info = ''

    xlauto = current_app._get_current_object()
    # run_script_worker(info_dict, script_total_list, timeout, xlauto)
    # db.get_engine(app=xlauto).dispose()
    # db.engine.dispose()
    # db.session.expunge(system_function_info)

    # start_list = []
    pool = ProcessPool()
    for host_user_info in host_user_infos:
        p = threading.Thread(target=exec_start,
                             args=(host_user_info, system_function_info,
                                   replace_parameters, xlauto))
        p.start()
    #     start_list_one = [host_user_info, system_function_info, replace_parameters,xlauto]
    #     start_list.append(start_list_one)
    # pool.start(exec_start, start_list)
    return True