summaryrefslogtreecommitdiff
path: root/command
diff options
context:
space:
mode:
author陈冠林 <[email protected]>2018-12-07 17:05:26 +0800
committer陈冠林 <[email protected]>2018-12-07 17:05:26 +0800
commitae0454ab86e470e5b8e7b524bb2c611753f8262f (patch)
tree58aace205bf682e1dc176d5b7dd09c2cbd30fc28 /command
parenta30d5b84fe5a64a159f8d77761a21863bdf365b5 (diff)
注释调试代码
Diffstat (limited to 'command')
-rw-r--r--command/views.py18
1 files 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&note=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