Dev to Main: corrections #2
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,9 +1,8 @@
|
||||
.idea
|
||||
.venv
|
||||
/data/
|
||||
/configs/config.json
|
||||
/configs/config.yaml
|
||||
/configs/metrics.json
|
||||
/configs/metrics_win.json
|
||||
/configs/config.*
|
||||
/configs/metrics.*
|
||||
/configs/metrics_win.*
|
||||
/__pycache__/
|
||||
/metrics/__pycache__/
|
||||
@ -35,7 +35,7 @@ def read_prop(filepath, sep='=', comment_char='#'):
|
||||
conf[key] = value
|
||||
return conf
|
||||
|
||||
def read_yaml(name): #ToDo: need to be tested!
|
||||
def read_yaml(name):
|
||||
conf = {}
|
||||
with open(name, 'r') as f:
|
||||
y_conf = yaml.safe_load(f)
|
||||
|
||||
@ -4,6 +4,7 @@ from abc import abstractmethod
|
||||
import time
|
||||
import platform
|
||||
import subprocess
|
||||
from linecache import cache
|
||||
|
||||
import requests
|
||||
import psutil
|
||||
@ -113,8 +114,13 @@ def get_shell_value(command, args, callback=None):
|
||||
def is_ping(ip, count, callback=None):
|
||||
param = '-n' if platform.system().lower() == 'windows' else '-c'
|
||||
command = ['ping', param, str(count), ip]
|
||||
output = subprocess.check_output(command)
|
||||
result = 'unreachable' not in str(output) and 'could not find' not in str(output) and 'time out' not in str(output)
|
||||
try:
|
||||
output = subprocess.check_output(command)
|
||||
result = ('unreachable'.upper() not in str(output).upper() and
|
||||
'could not find'.upper() not in str(output).upper() and
|
||||
'time out'.upper() not in str(output).upper())
|
||||
except:
|
||||
result = False
|
||||
if callback is not None:
|
||||
callback(result)
|
||||
else:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user