GeoView : differentiate ping between windows and linux.

svn: r14404
This commit is contained in:
Serge Noiraud 2010-02-16 18:54:49 +00:00
parent c59ee70155
commit c2239ec0e7

View File

@ -2291,16 +2291,18 @@ class GeoView(HtmlView):
"""
if constfunc.win():
command = "ping -n 2 "
stringtosearch = "([0-9]*)%.*"
#elif constfunc.mac():
# command = "ping -c 2 "
else:
stringtosearch = ".*, (.*)% packet loss.*"
command = "ping -c 2 "
pinghost = os.popen(command + host, "r")
line = pinghost.read()
if not line:
self.no_network = True
result = re.search('.*, (.*)% packet loss.*', line)
result = re.search(stringtosearch, line)
if result != None and int(result.group(1)) == 0:
if self.no_network == True:
self.no_network = False