Esempio n. 1
0
 def add_host(result):
     db = MysqlServer(settings.DATABASES)
     sql = (
         "insert into zc_machine (serverip, publicip , rid, memsize, cpunum, disksize, \
     serverrack, sn, stype, os, service, mstatus, ccid, comment, createtime) \
     values ('%s', '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s')"
         % (
             result["server_ip"],
             result["public_ip"],
             int(result["idc_name"]),
             result["mem_size"],
             result["cpu_num"],
             result["disk_size"],
             result["server_rack"],
             result["sn"],
             result["server_type"],
             result["os"],
             int(result["project_name"]),
             result["server_status"],
             int(result["server_contact"]),
             result["comment"],
             result["create_time"],
         )
     )
     db.execute_sql(sql)
     db.close()
Esempio n. 2
0
 def modify_host_update(result, mid):
     db = MysqlServer(settings.DATABASES)
     sql = (
         "update zc_machine set serverip='%s', publicip='%s', rid='%d', memsize='%s', cpunum='%s', \
      disksize='%s', serverrack='%s', sn='%s', stype='%s', os='%s', service='%d', mstatus='%s', ccid='%d', \
       comment='%s', modifytime='%s' where mid='%d' "
         % (
             result["server_ip"],
             result["public_ip"],
             int(result["idc_name"]),
             result["mem_size"],
             result["cpu_num"],
             result["disk_size"],
             result["server_rack"],
             result["sn"],
             result["server_type"],
             result["os"],
             int(result["project_name"]),
             result["server_status"],
             int(result["server_contact"]),
             result["comment"],
             result["modify_time"],
             int(mid),
         )
     )
     db.execute_sql(sql)
     db.close()
Esempio n. 3
0
 def set_room_modify(result, result_rid):
     db = MysqlServer(settings.DATABASES)
     sql = "update zc_idc set idcname='%s',contact='%s',phone='%s',comments='%s' where zc_idc.rid='%d'" % (
         result["room_name"], result["room_contact"],
         result["contact_phone"], result["room_comment"], int(result_rid))
     db.execute_sql(sql)
     db.close()
Esempio n. 4
0
 def set_add_room(result):
     db = MysqlServer(settings.DATABASES)
     sql = "insert into zc_idc (idcname,contact,phone,comments) values ('%s','%s','%s','%s')" % (
         result["room_name"], result["room_contact"],
         result["contact_phone"], result["room_comment"])
     db.execute_sql(sql)
     db.close()
Esempio n. 5
0
 def set_add_contact(result):
     db = MysqlServer(settings.DATABASES)
     sql = "insert into zc_contact (cname,cinfo) values ('%s','%s')" % (
         result["contact_name"],
         result["contact_info"],
     )
     db.execute_sql(sql)
     db.close()
Esempio n. 6
0
 def set_add_room(result):
     db = MysqlServer(settings.DATABASES)
     sql = "insert into zc_idc (idcname,contact,phone,comments) values ('%s','%s','%s','%s')" % (
         result["room_name"],
         result["room_contact"],
         result["contact_phone"],
         result["room_comment"],
     )
     db.execute_sql(sql)
     db.close()
Esempio n. 7
0
 def set_room_modify(result, result_rid):
     db = MysqlServer(settings.DATABASES)
     sql = "update zc_idc set idcname='%s',contact='%s',phone='%s',comments='%s' where zc_idc.rid='%d'" % (
         result["room_name"],
         result["room_contact"],
         result["contact_phone"],
         result["room_comment"],
         int(result_rid),
     )
     db.execute_sql(sql)
     db.close()
Esempio n. 8
0
 def add_host(result):
     db = MysqlServer(settings.DATABASES)
     sql = "insert into zc_machine (serverip, publicip , rid, memsize, cpunum, disksize, \
     serverrack, sn, stype, os, service, mstatus, ccid, comment, createtime) \
     values ('%s', '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s')"                                                                                                           % \
     (result["server_ip"], result["public_ip"], int(result["idc_name"]), result["mem_size"],
      result["cpu_num"], result["disk_size"], result["server_rack"], result["sn"],
      result["server_type"], result["os"], int(result["project_name"]), result["server_status"],
      int(result["server_contact"]), result['comment'], result['create_time'])
     db.execute_sql(sql)
     db.close()
Esempio n. 9
0
 def modify_host_update(result, mid):
     db = MysqlServer(settings.DATABASES)
     sql = "update zc_machine set serverip='%s', publicip='%s', rid='%d', memsize='%s', cpunum='%s', \
      disksize='%s', serverrack='%s', sn='%s', stype='%s', os='%s', service='%d', mstatus='%s', ccid='%d', \
       comment='%s', modifytime='%s' where mid='%d' "                                                         % \
     (result["server_ip"], result["public_ip"], int(result["idc_name"]), result["mem_size"],
      result["cpu_num"], result["disk_size"], result["server_rack"], result["sn"],
      result["server_type"], result["os"], int(result["project_name"]), result["server_status"],
      int(result["server_contact"]), result['comment'], result['modify_time'], int(mid))
     db.execute_sql(sql)
     db.close()
Esempio n. 10
0
 def set_add_project(result):
     db = MysqlServer(settings.DATABASES)
     sql = "insert into zc_service (sname) values ('%s')" % result
     db.execute_sql(sql)
     db.close()
Esempio n. 11
0
 def set_add_contact(result):
     db = MysqlServer(settings.DATABASES)
     sql = "insert into zc_contact (cname,cinfo) values ('%s','%s')" % (
         result["contact_name"], result["contact_info"])
     db.execute_sql(sql)
     db.close()
Esempio n. 12
0
 def set_add_project(result):
     db = MysqlServer(settings.DATABASES)
     sql = "insert into zc_service (sname) values ('%s')" % result
     db.execute_sql(sql)
     db.close()
Esempio n. 13
0
 def delete_contact(result):
     db = MysqlServer(settings.DATABASES)
     sql = "delete from zc_contact where ccid='%d'" % int(result)
     db.execute_sql(sql)
     db.close()
Esempio n. 14
0
 def delete_project(result):
     db = MysqlServer(settings.DATABASES)
     sql = "delete from zc_service where sid='%d'" % int(result)
     db.execute_sql(sql)
     db.close()
Esempio n. 15
0
 def add_user(result):
     db = MysqlServer(settings.DATABASES)
     sql = '''insert into zc_user (rid,username,userpassword) values ("%d","%s","%s")''' % (1, str(result["user_name"]), str(result["user_password"]))
     db.execute_sql(sql)
     db.close()
Esempio n. 16
0
 def delete_room_modify(result):
     db = MysqlServer(settings.DATABASES)
     sql = "delete from zc_idc where zc_idc.rid='%d'" % int(result)
     db.execute_sql(sql)
     db.close()
Esempio n. 17
0
 def user_delete(result):
     db = MysqlServer(settings.DATABASES)
     sql = "delete from zc_user where uid='%d'" % int(result)
     db.execute_sql(sql)
     db.close()
Esempio n. 18
0
 def user_modify_update(result, uid):
     db = MysqlServer(settings.DATABASES)
     sql = "update zc_user set username='******',userpassword='******' where uid='%s'" % (
         result["user_name"], result["user_password"], uid)
     db.execute_sql(sql)
     db.close()
Esempio n. 19
0
 def add_user(result):
     db = MysqlServer(settings.DATABASES)
     sql = '''insert into zc_user (rid,username,userpassword) values ("%d","%s","%s")''' % (
         1, str(result["user_name"]), str(result["user_password"]))
     db.execute_sql(sql)
     db.close()
Esempio n. 20
0
 def user_modify_update(result, uid):
     db = MysqlServer(settings.DATABASES)
     sql = "update zc_user set username='******',userpassword='******' where uid='%s'" % (result["user_name"],
     result["user_password"], uid)
     db.execute_sql(sql)
     db.close()
Esempio n. 21
0
 def delete_contact(result):
     db = MysqlServer(settings.DATABASES)
     sql = "delete from zc_contact where ccid='%d'" % int(result)
     db.execute_sql(sql)
     db.close()
Esempio n. 22
0
 def delete_project(result):
     db = MysqlServer(settings.DATABASES)
     sql = "delete from zc_service where sid='%d'" % int(result)
     db.execute_sql(sql)
     db.close()
Esempio n. 23
0
 def delete_host(result):
     db = MysqlServer(settings.DATABASES)
     sql = "delete from zc_machine where mid='%d'" % int(result)
     db.execute_sql(sql)
     db.close()
Esempio n. 24
0
 def delete_room_modify(result):
     db = MysqlServer(settings.DATABASES)
     sql = "delete from zc_idc where zc_idc.rid='%d'" % int(result)
     db.execute_sql(sql)
     db.close()
Esempio n. 25
0
 def delete_host(result):
     db = MysqlServer(settings.DATABASES)
     sql = "delete from zc_machine where mid='%d'" % int(result)
     db.execute_sql(sql)
     db.close()
Esempio n. 26
0
 def user_delete(result):
     db = MysqlServer(settings.DATABASES)
     sql = "delete from zc_user where uid='%d'" % int(result)
     db.execute_sql(sql)
     db.close()