Example #1
0
def apps_w():
    try:
        param = {}
        param['app_name'] = request.args.get('appname')  #应用名
        param['app_mod_name'] = request.args.get('appsname')  #模块名
        param['app_loser_name'] = request.args.get('username')  #负者人
        param['app_middleware'] = request.args.get('middleware')  #中间件
        param['app_jdkn'] = request.args.get('jdkn')  #java版本
        param['app_ojdbcn'] = request.args.get('ojdbcn')  #ojdbc版本
        param['app_prd_domain'] = request.args.get('domain_name')  #域名
        param['app_prd_ip'] = request.args.get('prd_ip')  #生产环境IP
        param['app_prd_ojdbc'] = request.args.get('prd_ojdbc')  #生产数据源
        param['app_dev_domain'] = request.args.get('dev_domain')  #测试域名
        param['app_dev_ip'] = request.args.get('dev_ip')  #测试环境IP
        param['app_dev_ojdbc'] = request.args.get('dev_ojdbc')  #测试数据源
        t_date = time.strftime('%Y%m%d%H%M%S', time.localtime(time.time()))
        param['app_date'] = t_date  # 录入时间
        print(param)
        insert_sql = "insert into abm.application (app_name,app_mod_name,app_loser_name,app_middleware,app_jdkn,app_date,app_prd_domain,app_prd_ip,app_dev_domain,app_dev_ip,app_prd_ojdbcip,app_dev_ojdbcip,app_ojdbcn) values (%(app_name)s,%(app_mod_name)s,%(app_loser_name)s,%(app_middleware)s,%(app_jdkn)s,%(app_date)s,%(app_prd_domain)s,%(app_prd_ip)s,%(app_dev_domain)s,%(app_dev_ip)s,%(app_prd_ojdbc)s,%(app_dev_ojdbc)s,%(app_ojdbcn)s)"
        app = mysql_insert(sql_cmd=insert_sql, param=param)
        select_sql = "SELECT app_name,app_mod_name,app_loser_name,app_middleware,app_jdkn,app_ojdbcn,app_date,app_prd_domain,app_prd_ip,app_prd_ojdbcip,app_dev_domain,app_dev_ip,app_dev_ojdbcip FROM abm.application where app_name=%(app_name)s and app_mod_name=%(app_mod_name)s and app_name!=''"
        app_aelect = mysql_select(sql_query=select_sql, param=param)
        return render_template('appw.html', appslist=app_aelect, pyError=app)
        #return render_template('appw.html',appslist=app_aelect)
    except TypeError as e:
        return ("录入错误:" + e)
Example #2
0
def apps_rw():
    try:
        param = {}
        param['app_name'] = request.args.get('appname')  # 应用名
        param['app_mod_name'] = request.args.get('appsname')  # 模块名
        param['app_loser_name'] = request.args.get('username')  # 负者人
        param['app_middleware'] = request.args.get('middleware')  # 中间件
        param['app_jdkn'] = request.args.get('jdkn')  # java版本
        param['app_ojdbcn'] = request.args.get('ojdbcn')  # ojdbc版本
        param['app_prd_domain'] = request.args.get('domain_name')  # 域名
        param['app_prd_ip'] = request.args.get('prd_ip')  # 生产环境IP
        param['app_prd_ojdbc'] = request.args.get('prd_ojdbc')  # 生产数据源
        param['app_dev_domain'] = request.args.get('dev_domain')  # 测试域名
        param['app_dev_ip'] = request.args.get('dev_ip')  # 测试环境IP
        param['app_dev_ojdbc'] = request.args.get('dev_ojdbc')  # 测试数据源
        #t_date = time.strftime('%Y%m%d%H%M%S', time.localtime(time.time()))
        #param['app_date'] = t_date  # 录入时间
        param['app_id'] = request.args.get('app_id')
        uodata_sql = """ update abm.application set app_name=%(app_name)s,app_mod_name=%(app_mod_name)s,app_loser_name=%(app_loser_name)s,app_middleware=%(app_middleware)s,app_jdkn=%(app_jdkn)s,app_prd_domain=%(app_prd_domain)s,app_prd_ip=%(app_prd_ip)s,app_dev_domain=%(app_dev_domain)s,app_dev_ip=%(app_dev_ip)s,app_prd_ojdbcip=%(app_prd_ojdbc)s,app_dev_ojdbcip=%(app_dev_ojdbc)s,app_ojdbcn=%(app_ojdbcn)s where app_id = %(app_id)s """
        mysql_updata(sql_cmd=uodata_sql, param=param)
        select_sql = 'SELECT app_id,app_name,app_mod_name,app_loser_name,app_middleware,app_jdkn,app_ojdbcn,app_date,app_prd_domain,app_prd_ip,app_prd_ojdbcip,app_dev_domain,app_dev_ip,app_dev_ojdbcip FROM abm.application where app_id=%(app_id)s  and app_name!="" '
        sql_data = mysql_select(sql_query=select_sql, param=param)
        return render_template('appr2.html', data=sql_data)
    except TabError as e:
        return ("错误:" + e)
Example #3
0
def server_wo():
    try:
        c = []
        param = []
        param.append(request.args.get('serversn'))
        param.append(request.args.get('servername'))
        param.append(request.args.get('serverasn'))
        param.append(request.args.get('serverip'))
        param.append(time.strftime('%Y%m%d%H%M%S',
                                   time.localtime(time.time())))
        param.append(request.args.get('Row'))
        param.append(request.args.get('column'))
        param.append(request.args.get('U_Number'))
        c_data = {}
        c_data['ge_id'] = request.args.get('g_id')
        sql_cmd = "insert into abm.the_server (server_sn,server_name,asset_sn,server_ip,server_date,server_p,server_l,server_u) VALUES (%s,%s,%s,%s,%s,%s,%s,%s);"
        param = tuple(param)
        mysql_insert(sql_cmd, param)
        date = {}
        date['server_sn'] = param[0]
        date['server_ip'] = param[3]
        select_cmd = "select server_id from abm.the_server where server_sn=%(server_sn)s AND server_ip=%(server_ip)s;"
        server_id = mysql_select(sql_query=select_cmd, param=date)
        #print(server_id[0][0])
        if len(server_id) > 0:
            c_data['server_id'] = server_id[0][0]
            #print(c_data['server_id'])
            sql_insert = "insert into abm.server_geography (ge_id,server_id) value (%(ge_id)s,%(server_id)s)"
            mysql_insert(sql_cmd=sql_insert, param=c_data)
            return ('录入完成')
        else:
            return ("录入失败")
    except TypeError:
        return ("录入错误")
Example #4
0
def apps_r():
    try:
        param = {}
        param['app_name'] = request.args.get('appname')  #应用名
        if param['app_name'] == 'ALL':
            param['app_name'] = '.*'
        param['app_mod_name'] = request.args.get('appsname')  #模块名
        if param['app_mod_name'] == 'ALL':
            param['app_mod_name'] = '.*'
        param['app_loser_name'] = request.args.get('username')  #负者人
        if param['app_loser_name'] == 'ALL':
            param['app_loser_name'] = '.*'
        param['app_middleware'] = request.args.get('middleware')  #中间件
        if param['app_middleware'] == 'ALL':
            param['app_middleware'] = '.*'
        param['app_jdkn'] = request.args.get('jdkn')  #java版本
        if param['app_jdkn'] == 'ALL':
            param['app_jdkn'] = '.*'
        param['app_ojdbcn'] = request.args.get('ojdbcn')  #ojdbc版本
        if param['app_ojdbcn'] == 'ALL':
            param['app_ojdbcn'] = '.*'

        select_sql = 'SELECT app_id,app_name,app_mod_name,app_loser_name,app_middleware,app_jdkn,app_ojdbcn,app_date,app_prd_domain,app_prd_ip,app_prd_ojdbcip,app_dev_domain,app_dev_ip,app_dev_ojdbcip FROM abm.application where app_name regexp %(app_name)s and app_mod_name regexp %(app_mod_name)s and app_loser_name regexp %(app_loser_name)s and app_middleware regexp %(app_middleware)s and app_jdkn regexp %(app_jdkn)s and app_ojdbcn regexp %(app_ojdbcn)s and app_name!="" '
        sql_data = mysql_select(sql_query=select_sql, param=param)
        print(sql_data)
        return render_template('appr.html', data=sql_data)
    except TabError as e:
        return ("错误:" + e)
Example #5
0
def server_ro():
    try:
        param = {}
        param['server_sn'] = request.args.get('serversn')
        param['server_name'] = request.args.get('servername')
        param['asset_sn'] = request.args.get('serverasn')
        param['server_ip'] = request.args.get('serverip')
        param['server_p'] = request.args.get('Row')
        param['server_l'] = request.args.get('column')
        param['server_u'] = request.args.get('U_Number')

        if param['server_sn'] == 'ALL':
            param['server_sn'] = '.*'
        if param['server_name'] == 'ALL':
            param['server_name'] = '.*'
        if param['asset_sn'] == 'ALL':
            param['asset_sn'] = '.*'
        if param['server_ip'] == 'ALL':
            param['server_ip'] = '.*'
        if param['server_p'] == 'ALL':
            param['server_p'] = '.*'
        if param['server_l'] == 'ALL':
            param['server_l'] = '.*'
        if param['server_u'] == 'ALL':
            param['server_u'] = '.*'
        #print(param)
        sql_query = "SELECT server_id,server_sn,server_name,asset_sn,server_ip,server_date,server_p,server_l,server_u FROM abm.the_server where server_sn regexp %(server_sn)s and server_name regexp %(server_name)s and asset_sn regexp %(asset_sn)s and server_ip regexp %(server_ip)s and server_p regexp %(server_p)s and server_l regexp %(server_l)s and server_u regexp %(server_u)s;"
        service_select = mysql_select(sql_query, param)
        #print (service_select)
        return render_template('serverr.html', service_select=service_select)
    except TypeError:
        return ("查询错误")
Example #6
0
def geography_r():
    try:
        gid_data = {}
        gid_data['ge_id'] = request.args.get('g_id')
        print(gid_data)
        select_cmd = "select server_sn,server_name,asset_sn,server_ip,server_date,server_p,server_l,server_u,ge_name from abm.the_server as a join abm.server_geography as ag join abm.geography as g where ag.ge_id=g.ge_id and a.server_id=ag.server_id and ag.ge_id=%(ge_id)s;"
        server_data = mysql_select(sql_query=select_cmd, param=gid_data)
        print(server_data)
        param = (".*", )
        sql_query = "select ge_id,ge_name,ge_addr from abm.geography where ge_name regexp %s;"
        f = mysql_select(sql_query, param)
        return render_template('gh.html',
                               service_select=server_data,
                               gname=f,
                               g_Total=len(server_data))

    except TypeError:
        return ("错误")
Example #7
0
def server_updata():
    try:
        param = {}
        param['server_id'] = request.args.get('serverid')
        param['server_sn'] = request.args.get('serversn')
        param['server_name'] = request.args.get('servername')
        param['asset_sn'] = request.args.get('serverasn')
        param['server_ip'] = request.args.get('serverip')
        param['server_p'] = request.args.get('Row')
        param['server_l'] = request.args.get('column')
        param['server_u'] = request.args.get('U_Number')
        #print (param)
        uodata_sql = """ update abm.the_server set server_sn=%(server_sn)s,server_name=%(server_name)s,asset_sn=%(asset_sn)s,server_ip=%(server_ip)s,server_p=%(server_p)s,server_l=%(server_l)s,server_u=%(server_u)s where server_id=%(server_id)s """
        mysql_updata(sql_cmd=uodata_sql, param=param)
        sql_query = "SELECT server_id,server_sn,server_name,asset_sn,server_ip,server_date,server_p,server_l,server_u FROM abm.the_server where server_id=%(server_id)s"
        service_select = mysql_select(sql_query, param)
        return render_template('serverr.html', service_select=service_select)
    except TabError as e:
        return e
Example #8
0
def g_r():
    param = (".*", )
    sql_query = "select ge_id,ge_name,ge_addr from abm.geography where ge_name regexp %s;"
    f = mysql_select(sql_query, param)
    return render_template('gh.html', gname=f)
Example #9
0
def server_w():
    param = (".*", )
    sql_query = "select ge_id,ge_name from abm.geography where ge_name regexp %s;"
    f = mysql_select(sql_query, param)
    return render_template('serverw.html', gname=f)