diff --git a/app/modules/tools/common.py b/app/modules/tools/common.py index 084a9a8..de9274c 100644 --- a/app/modules/tools/common.py +++ b/app/modules/tools/common.py @@ -6,12 +6,20 @@ import modules.server.server as server_mod def get_services_status(): - update_cur_tool_versions() services = [] services_name = sql.get_all_tools() - for s, v in services_name.items(): - status = is_tool_active(s) - services.append([s, status, v]) + + 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(): + status = is_tool_active(s) + services.append([s, status, v]) + except Exception as e: + raise Exception(f'error: Cannot get tools status: {e}') 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}'" else: 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: 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) - if service_ver == 'command' or service_ver == 'prometheus:': - service_ver = '' + try: + 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: diff --git a/config_other/requirements_el7.txt b/config_other/requirements_el7.txt index b00c34d..66ed947 100644 --- a/config_other/requirements_el7.txt +++ b/config_other/requirements_el7.txt @@ -8,10 +8,11 @@ PyMySQL>=1.0.2 retry>=0.9.2 pdpyras>=4.5.2 tzlocal==2.0.0 -Flask>=2.0.3 -Flask-Login>=0.4.1 -Flask-Caching>=1.10.1 -Flask-APScheduler>=1.12.4 +Werkzeug==2.2.3 +Flask==2.2.5 +Flask-Login==0.6.2 +Flask-APScheduler==1.13.0 +Flask-Caching==2.1.0 python3-nmap<=1.5.1 aio-pika>=7.1.0 pika>=1.2.0 diff --git a/config_other/requirements_el8.txt b/config_other/requirements_el8.txt index 0fbf8cf..f00e8c7 100644 --- a/config_other/requirements_el8.txt +++ b/config_other/requirements_el8.txt @@ -9,10 +9,11 @@ bottle>=0.12.18 retry>=0.9.2 tzlocal==2.0.0 pdpyras>=4.5.2 -Flask>=2.0.3 -Flask-Login>=0.4.1 -Flask-Caching>=1.10.1 -Flask-APScheduler>=1.12.4 +Werkzeug==2.2.3 +Flask==2.2.5 +Flask-Login==0.6.2 +Flask-APScheduler==1.13.0 +Flask-Caching==2.1.0 python3-nmap<=1.5.1 aio-pika>=7.1.0 pika>=1.2.0 diff --git a/config_other/requirements_el9.txt b/config_other/requirements_el9.txt index ac2c702..6808ec8 100644 --- a/config_other/requirements_el9.txt +++ b/config_other/requirements_el9.txt @@ -8,10 +8,11 @@ PyMySQL>=1.0.2 bottle>=0.12.18 retry>=0.9.2 pdpyras>=4.5.2 -Flask>=2.0.3 -Flask-Login>=0.4.1 -Flask-Caching>=1.10.1 -Flask-APScheduler>=1.12.4 +Werkzeug==2.2.3 +Flask==2.2.5 +Flask-Login==0.6.2 +Flask-APScheduler==1.13.0 +Flask-Caching==2.1.0 python3-nmap<=1.5.1 aio-pika>=7.1.0 pika>=1.2.0 diff --git a/requirements.txt b/requirements.txt index d914c13..666478b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,7 +16,8 @@ bottle>=0.12.20 psutil>=5.9.1 pdpyras>=4.5.2 pika>=1.3.1 -Flask>=2.0.3 -Flask-Login>=0.4.1 -Flask-Caching>=1.10.1 -Flask-APScheduler>=1.12.4 +Werkzeug==2.2.3 +Flask==2.2.5 +Flask-Login==0.6.2 +Flask-APScheduler==1.13.0 +Flask-Caching==2.1.0