FIX: When sending issues to android tablet (via Sync/Send) using the Readinglist, would always return a 'host is not Reachable at this time' error message when it would be reachable (only occurred on Windows)

This commit is contained in:
evilhero 2015-11-19 21:25:00 -05:00
parent fb3c30de94
commit a32264eacd
1 changed files with 9 additions and 2 deletions

View File

@ -213,13 +213,20 @@ class Readinglist(object):
#fhost = mylar.TAB_HOST.find(':') #fhost = mylar.TAB_HOST.find(':')
host = mylar.TAB_HOST[:mylar.TAB_HOST.find(':')] host = mylar.TAB_HOST[:mylar.TAB_HOST.find(':')]
if 'windows' not in mylar.OS_DETECT.lower():
cmdstring = str('ping -c1 ' + str(host)) cmdstring = str('ping -c1 ' + str(host))
else:
cmdstring = str('ping -n 1 ' + str(host))
cmd = shlex.split(cmdstring) cmd = shlex.split(cmdstring)
try: try:
output = subprocess.check_output(cmd) output = subprocess.check_output(cmd)
except subprocess.CalledProcessError, e: except subprocess.CalledProcessError, e:
logger.info(module + ' The host {0} is not Reachable at this time.'.format(cmd[-1])) logger.info(module + ' The host {0} is not Reachable at this time.'.format(cmd[-1]))
return return
else:
if 'unreachable' in output:
logger.info(module + ' The host {0} is not Reachable at this time.'.format(cmd[-1]))
return
else: else:
logger.info(module + ' The host {0} is Reachable. Preparing to send files.'.format(cmd[-1])) logger.info(module + ' The host {0} is Reachable. Preparing to send files.'.format(cmd[-1]))