Changelog: https://roxy-wi.org/changelog#7.0.1
pull/366/head
Aidaho 1 year ago
parent 95dc978c3b
commit bcdd41bcd5

@ -6,12 +6,20 @@ import modules.server.server as server_mod
def get_services_status(): def get_services_status():
update_cur_tool_versions()
services = [] services = []
services_name = sql.get_all_tools() services_name = sql.get_all_tools()
try:
update_cur_tool_versions()
except Exception as e:
raise Exception(f'error: Update current versions: {e}')
try:
for s, v in services_name.items(): for s, v in services_name.items():
status = is_tool_active(s) status = is_tool_active(s)
services.append([s, status, v]) services.append([s, status, v])
except Exception as e:
raise Exception(f'error: Cannot get tools status: {e}')
return services return services
@ -72,16 +80,23 @@ def update_cur_tool_version(tool_name: str) -> None:
cmd = "prometheus --version 2>&1 |grep prometheus|awk '{print $3}'" cmd = "prometheus --version 2>&1 |grep prometheus|awk '{print $3}'"
else: else:
if distro.id() == 'ubuntu': if distro.id() == 'ubuntu':
cmd = f"apt list --installed 2>&1 |grep {correct_name}|awk '{{print $2}}'|sed 's/-/./'" if tool_name == 'roxy-wi-keep_alive':
correct_name = 'roxy-wi-keep-alive'
cmd = f"apt show {correct_name}|grep Version |awk '{{print $2}}'"
else: else:
cmd = f"rpm -q {correct_name}|awk -F\"{correct_name}\" '{{print $2}}' |awk -F\".noa\" '{{print $1}}' |sed 's/-//1' |sed 's/-/./'" cmd = f"rpm -q {correct_name}|awk -F\"{correct_name}\" '{{print $2}}' |awk -F\".noa\" '{{print $1}}' |sed 's/-//1' |sed 's/-/./'"
service_ver, stderr = server_mod.subprocess_execute(cmd) service_ver, stderr = server_mod.subprocess_execute(cmd)
if service_ver == 'command' or service_ver == 'prometheus:': try:
service_ver = '' service_ver = service_ver[0]
except Exception:
service_ver = 0
if service_ver in ('command', 'prometheus:', 'not'):
service_ver = 0
sql.update_tool_cur_version(tool_name, service_ver[0]) sql.update_tool_cur_version(tool_name, service_ver)
def get_cur_tool_version(tool_name: str) -> str: def get_cur_tool_version(tool_name: str) -> str:

@ -8,10 +8,11 @@ PyMySQL>=1.0.2
retry>=0.9.2 retry>=0.9.2
pdpyras>=4.5.2 pdpyras>=4.5.2
tzlocal==2.0.0 tzlocal==2.0.0
Flask>=2.0.3 Werkzeug==2.2.3
Flask-Login>=0.4.1 Flask==2.2.5
Flask-Caching>=1.10.1 Flask-Login==0.6.2
Flask-APScheduler>=1.12.4 Flask-APScheduler==1.13.0
Flask-Caching==2.1.0
python3-nmap<=1.5.1 python3-nmap<=1.5.1
aio-pika>=7.1.0 aio-pika>=7.1.0
pika>=1.2.0 pika>=1.2.0

@ -9,10 +9,11 @@ bottle>=0.12.18
retry>=0.9.2 retry>=0.9.2
tzlocal==2.0.0 tzlocal==2.0.0
pdpyras>=4.5.2 pdpyras>=4.5.2
Flask>=2.0.3 Werkzeug==2.2.3
Flask-Login>=0.4.1 Flask==2.2.5
Flask-Caching>=1.10.1 Flask-Login==0.6.2
Flask-APScheduler>=1.12.4 Flask-APScheduler==1.13.0
Flask-Caching==2.1.0
python3-nmap<=1.5.1 python3-nmap<=1.5.1
aio-pika>=7.1.0 aio-pika>=7.1.0
pika>=1.2.0 pika>=1.2.0

@ -8,10 +8,11 @@ PyMySQL>=1.0.2
bottle>=0.12.18 bottle>=0.12.18
retry>=0.9.2 retry>=0.9.2
pdpyras>=4.5.2 pdpyras>=4.5.2
Flask>=2.0.3 Werkzeug==2.2.3
Flask-Login>=0.4.1 Flask==2.2.5
Flask-Caching>=1.10.1 Flask-Login==0.6.2
Flask-APScheduler>=1.12.4 Flask-APScheduler==1.13.0
Flask-Caching==2.1.0
python3-nmap<=1.5.1 python3-nmap<=1.5.1
aio-pika>=7.1.0 aio-pika>=7.1.0
pika>=1.2.0 pika>=1.2.0

@ -16,7 +16,8 @@ bottle>=0.12.20
psutil>=5.9.1 psutil>=5.9.1
pdpyras>=4.5.2 pdpyras>=4.5.2
pika>=1.3.1 pika>=1.3.1
Flask>=2.0.3 Werkzeug==2.2.3
Flask-Login>=0.4.1 Flask==2.2.5
Flask-Caching>=1.10.1 Flask-Login==0.6.2
Flask-APScheduler>=1.12.4 Flask-APScheduler==1.13.0
Flask-Caching==2.1.0

Loading…
Cancel
Save