From ae0454ab86e470e5b8e7b524bb2c611753f8262f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=86=A0=E6=9E=97?= Date: Fri, 7 Dec 2018 17:05:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E8=B0=83=E8=AF=95=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- command/views.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/command/views.py b/command/views.py index 9889a1e..efc37bf 100644 --- a/command/views.py +++ b/command/views.py @@ -38,13 +38,13 @@ class Redis: pool = redis.ConnectionPool(host=self.host, port=self.port, db=self.index,decode_responses=True) r = redis.StrictRedis(connection_pool=pool) except redis.RedisError as e:# Exception,e:print(str(e)) - print("Error:"+str(e)) + # print("Error:"+str(e)) return -1,"Error:"+str(e) # sys.exit(2) try: connect_result=r.ping() except redis.ConnectionError: - print("Error:can not connect to redis server with host:"+self.host+" and port:"+self.port) + # print("Error:can not connect to redis server with host:"+self.host+" and port:"+self.port) return -1,"Error:can not connect to redis server with host:"+self.host+" and port:"+self.port # sys.exit(2) else: @@ -52,7 +52,7 @@ class Redis: self.r=r return 0,"success" else: - print("Error:Ping the Redis server returns not True, check again.") + # print("Error:Ping the Redis server returns not True, check again.") return -1,"Error:Ping the Redis server returns not True, check again." # sys.exit(2) # http:\\localhost:8090\command?cmd_obj=server&cmd=UserCreate&server_pwd=111111&hub_name=NewHub0&hub_pwd=111111&user_name=*&group=none&realname=none¬e=none @@ -72,7 +72,7 @@ def command(request): return myresponse elif(command=='IpExist'): candidate_ip=request.GET.get('candidate_ip',default=None) - print(candidate_ip) + # print(candidate_ip) if(candidate_ip==None): my_dict=dict() my_dict['error']=response_dic['miss'] @@ -258,7 +258,7 @@ def command(request): user_dict['User_Name']=user_info[0] user_dict['Num_Logins']=user_info[5] if(user_info[6].find('None')==-1): - print(user_info[6]) + # print(user_info[6]) temp_str=user_info[6].split(' ') temp_str=temp_str[0]+' '+temp_str[2] user_dict['Last_Login']=temp_str @@ -289,7 +289,7 @@ def command(request): return myresponse else: command=hub_cmd+' '+command+' '+user_name - print(command) + # print(command) outs,rtn_code=mysubprocess(command) if(rtn_code==0): my_dict=dict() @@ -350,7 +350,7 @@ def command(request): else: my_dict['Outgoing_Unicast_Total_Size']=transfer_info[8].replace(',','') elif(user_info[0].find('Outgoing Broadcast Packets')!=-1): - print(transfer_info,transfer_info_short) + # print(transfer_info,transfer_info_short) if(my_list[x].find('\"')==-1): my_dict['Outgoing_Broadcast_Packets']=transfer_info_short[6].replace(',','') else: @@ -527,8 +527,8 @@ def mysubprocess(command, timeout1 = 6): outs = outs.decode("utf-8") rtn_code = ssh_process.returncode if rtn_code!= 0 and errs != '': - print("rtn_code: " + str(rtn_code)) - print("errs: " + errs) + # print("rtn_code: " + str(rtn_code)) + # print("errs: " + errs) raise Exception("subprocess failed") return outs,rtn_code