增加了配置文件hub_name

This commit is contained in:
陈冠林
2018-12-04 19:55:23 +08:00
parent b6021cd634
commit 366cbd5997
10 changed files with 6 additions and 160 deletions

View File

@@ -59,7 +59,7 @@ class Redis:
# Create your views here.
def command(request):
# if username == "" and password = "" :
server_pwd,host,port,index=readconfig()
server_pwd,host,port,index,hub_name=readconfig()
if request.method=='GET':
cmd_obj=request.GET.get('cmd_obj',default='server')
if cmd_obj=='server':
@@ -166,7 +166,7 @@ def command(request):
# command=server_cmd+' '+command_dic['password']+password+' '+command_dic['adminhub']+' '+command_dic['password']+password+' '+\
# command_dic['csv']+' '+command_dic['cmd']+' '+command
server_pwd=request.GET.get('server_pwd',default=server_pwd)
hub_name=request.GET.get('hub_name',default='NewHub0')
hub_name=request.GET.get('hub_name',default=hub_name)
hub_pwd=request.GET.get('hub_pwd',default='111111')
hub_cmd=server_cmd+' '+command_dic['password']+server_pwd+' '+command_dic['hub']+hub_name+' '+command_dic['password']+hub_pwd+' '\
+command_dic['cmd']
@@ -289,6 +289,7 @@ def command(request):
return myresponse
else:
command=hub_cmd+' '+command+' '+user_name
print(command)
outs,rtn_code=mysubprocess(command)
if(rtn_code==0):
my_dict=dict()
@@ -535,10 +536,11 @@ def readconfig():
myconfig=configparser.ConfigParser()
myconfig.read("CGI_config.conf")
server_pwd=myconfig.get("server","server_pwd")
hub_name=myconfig.get("server","hub_name")
host=myconfig.get("redis","host")
port=myconfig.get("redis","port")
index=myconfig.get("redis","index")
return server_pwd,host,port,index
return server_pwd,host,port,index,hub_name
def IpExist(host,port,candidate_ip,index):
P=Redis(host,port,index)