Fix showing Checker setting on Ubuntu
pull/372/head
Aidaho 2023-11-03 08:36:54 +03:00
parent 62071588e9
commit 4727848abc
4 changed files with 22 additions and 22 deletions

View File

@ -781,9 +781,6 @@ def get_user_id_by_uuid(uuid):
else: else:
for user in query_res: for user in query_res:
return user.user_id return user.user_id
finally:
if not conn.is_closed():
conn.close()
def get_user_id_by_username(username: str): def get_user_id_by_username(username: str):

View File

@ -7,13 +7,13 @@ import modules.server.server as server_mod
def get_services_status(update_cur_ver=0): def get_services_status(update_cur_ver=0):
services = [] services = []
services_name = sql.get_all_tools()
if update_cur_ver: if update_cur_ver:
try: try:
update_cur_tool_versions() update_cur_tool_versions()
except Exception as e: except Exception as e:
raise Exception(f'error: Update current versions: {e}') raise Exception(f'error: Cannot update current versions: {e}')
services_name = sql.get_all_tools()
try: try:
for s, v in services_name.items(): for s, v in services_name.items():
@ -32,20 +32,15 @@ def update_roxy_wi(service: str) -> str:
if service not in services: if service not in services:
raise Exception(f'error: {service} is not part of Roxy-WI') raise Exception(f'error: {service} is not part of Roxy-WI')
if service != 'roxy-wi':
restart_service = f'&& sudo systemctl restart {service}'
if distro.id() == 'ubuntu': if distro.id() == 'ubuntu':
try: if service == 'roxy-wi-keep_alive':
if service == 'roxy-wi-keep_alive': service = 'roxy-wi-keep-alive'
service = 'roxy-wi-keep-alive'
except Exception:
pass
if service != 'roxy-wi': cmd = f'sudo -S apt-get update && sudo apt-get install {service} -y {restart_service}'
restart_service = f'&& sudo systemctl restart {service}'
cmd = f'sudo -S apt-get update && sudo apt-get install {service} {restart_service} -y'
else: else:
if service != 'roxy-wi':
restart_service = f'&& sudo systemctl restart {service}'
cmd = f'sudo -S yum -y install {service} {restart_service}' cmd = f'sudo -S yum -y install {service} {restart_service}'
output, stderr = server_mod.subprocess_execute(cmd) output, stderr = server_mod.subprocess_execute(cmd)

View File

@ -128,7 +128,7 @@ def return_smon_status():
return smon_status, stderr return smon_status, stderr
def check_uptime(smon_id: int) -> int: def check_uptime(smon_id: str) -> int:
count_checks = sql.get_smon_history_count_checks(smon_id) count_checks = sql.get_smon_history_count_checks(smon_id)
try: try:
@ -164,10 +164,19 @@ def show_status_page(slug: str) -> str:
checks = sql.select_status_page_checks(page_id) checks = sql.select_status_page_checks(page_id)
for check in checks: for check in checks:
name = ''
desc = ''
group = ''
check_type = ''
check_id = str(check.check_id) check_id = str(check.check_id)
smon_name = sql.get_smon_service_name_by_id(check_id) smon = sql.select_smon_by_id(check_id)
for s in smon:
name = s.name
desc = s.desc
group = s.group
check_type = s.check_type
uptime = check_uptime(check_id) uptime = check_uptime(check_id)
checks_status[check_id] = {'uptime': uptime, 'name': smon_name} checks_status[check_id] = {'uptime': uptime, 'name': name, 'desc': desc, 'group': group, 'check_type': check_type}
return render_template('smon/status_page.html', page=page, checks_status=checks_status) return render_template('smon/status_page.html', page=page, checks_status=checks_status)

View File

@ -72,7 +72,6 @@ def smon_dashboard(dashboard_id, check_id):
) )
@bp.route('/status-page') @bp.route('/status-page')
@login_required @login_required
@get_user_params() @get_user_params()