From d619497ab21994b3aa6126fba153f8fce302753f Mon Sep 17 00:00:00 2001 From: Aidaho Date: Sat, 16 Dec 2023 11:34:45 +0300 Subject: [PATCH] v7.1.0.0 Changelog: https://roxy-wi.org/changelog#7.1.0 --- app/jobs.py | 1 - app/modules/db/sql.py | 2 +- app/modules/service/ha_cluster.py | 6 +++--- app/modules/service/installation.py | 2 +- app/modules/service/keepalived.py | 4 ++-- app/routes/ha/routes.py | 1 - app/routes/install/routes.py | 3 +-- config_other/requirements_el7.txt | 2 +- config_other/requirements_el8.txt | 2 +- config_other/requirements_el9.txt | 2 +- requirements.txt | 2 +- 11 files changed, 12 insertions(+), 15 deletions(-) diff --git a/app/jobs.py b/app/jobs.py index 3d3240c..6c7c9ba 100644 --- a/app/jobs.py +++ b/app/jobs.py @@ -93,4 +93,3 @@ def delete_ansible_artifacts(): shutil.rmtree(f'{ansible_path}/{folder}') except Exception as e: raise Exception(f'error: Cron cannot delete ansible folders: {e}') - diff --git a/app/modules/db/sql.py b/app/modules/db/sql.py index afee912..4eac9cc 100755 --- a/app/modules/db/sql.py +++ b/app/modules/db/sql.py @@ -4509,7 +4509,7 @@ def update_ha_virt_ip(vip_id: int, vip: str) -> None: def delete_ha_virt(vip_id: int) -> None: try: Server.delete().where(Server.server_id == HaClusterVirt.get(HaClusterVirt.vip_id == vip_id).virt_id).execute() - except Exception as e: + except Exception: pass diff --git a/app/modules/service/ha_cluster.py b/app/modules/service/ha_cluster.py index 591f37e..ec59136 100644 --- a/app/modules/service/ha_cluster.py +++ b/app/modules/service/ha_cluster.py @@ -14,7 +14,7 @@ def create_cluster(cluster: object, group_id: int) -> str: try: cluster_id = sql.create_cluster(cluster['name'], syn_flood, group_id, cluster['desc']) - roxywi_common.logging(cluster_id, f'New cluster has been created', keep_history=1, roxywi=1, service='HA cluster') + roxywi_common.logging(cluster_id, 'New cluster has been created', keep_history=1, roxywi=1, service='HA cluster') except Exception as e: return f'error: Cannot create new HA cluster: {e}' @@ -115,13 +115,13 @@ def delete_cluster(cluster_id: int) -> str: slaves = sql.select_cluster_slaves(cluster_id) for slave in slaves: - slave_ip = select_server_ip_by_id(slave.server_id) + slave_ip = sql.select_server_ip_by_id(slave.server_id) try: sql.update_server_master(0, slave_ip) except Exception as e: raise Exception(f'error: Cannot update master on slave {slave_ip}: {e}') - roxywi_common.logging(cluster_id, f'Cluster {cluster_name} has been deleted', keep_history=1, roxywi=1, service='HA cluster') + roxywi_common.logging(cluster_id, f'Cluster has been deleted', keep_history=1, roxywi=1, service='HA cluster') return 'ok' diff --git a/app/modules/service/installation.py b/app/modules/service/installation.py index 4f406c4..5ebdada 100644 --- a/app/modules/service/installation.py +++ b/app/modules/service/installation.py @@ -185,7 +185,7 @@ def grafana_install(): def generate_kp_inv(json_data: json, install_service) -> object: json_data = json.loads(json_data) - inv = {"server": {"hosts":{}}} + inv = {"server": {"hosts": {}}} server_ips = [] cluster_id = int(json_data['cluster_id']) haproxy = json_data['services']['haproxy']['enabled'] diff --git a/app/modules/service/keepalived.py b/app/modules/service/keepalived.py index 4bb6a4c..5fe3b9a 100644 --- a/app/modules/service/keepalived.py +++ b/app/modules/service/keepalived.py @@ -13,8 +13,8 @@ def get_status(server_ip: str) -> tuple: for k in out.split(): out1.append(k) h = (out1,) - servers_with_status1= h - servers_with_status2= h + servers_with_status1 = h + servers_with_status2 = h except Exception: servers_with_status1 = h servers_with_status2 = h diff --git a/app/routes/ha/routes.py b/app/routes/ha/routes.py index f0bed7c..c4fc6ea 100644 --- a/app/routes/ha/routes.py +++ b/app/routes/ha/routes.py @@ -3,7 +3,6 @@ import json from flask import render_template, g, request, jsonify from flask_login import login_required -from app import app from app.routes.ha import bp from middleware import get_user_params, check_services import modules.db.sql as sql diff --git a/app/routes/install/routes.py b/app/routes/install/routes.py index ab93b32..4584737 100644 --- a/app/routes/install/routes.py +++ b/app/routes/install/routes.py @@ -1,4 +1,4 @@ -from flask import render_template, request, g, abort +from flask import render_template, request, g from flask_login import login_required from app.routes.install import bp @@ -6,7 +6,6 @@ from middleware import get_user_params, check_services import app.modules.db.sql as sql import app.modules.common.common as common import app.modules.roxywi.auth as roxywi_auth -import app.modules.roxywi.common as roxywi_common import app.modules.server.server as server_mod import app.modules.service.common as service_common import app.modules.service.installation as service_mod diff --git a/config_other/requirements_el7.txt b/config_other/requirements_el7.txt index 6f2fdef..4488015 100644 --- a/config_other/requirements_el7.txt +++ b/config_other/requirements_el7.txt @@ -17,4 +17,4 @@ python3-nmap<=1.5.1 aio-pika>=7.1.0 pika>=1.2.0 websockets>=9.0 -ansible-runner==2.3.2 +ansible-runner==2.3.1 diff --git a/config_other/requirements_el8.txt b/config_other/requirements_el8.txt index de3190a..a332f88 100644 --- a/config_other/requirements_el8.txt +++ b/config_other/requirements_el8.txt @@ -18,4 +18,4 @@ python3-nmap<=1.5.1 aio-pika>=7.1.0 pika>=1.2.0 websockets>=9.0 -ansible-runner==2.3.2 +ansible-runner==2.3.1 diff --git a/config_other/requirements_el9.txt b/config_other/requirements_el9.txt index 086d50f..36b19b4 100644 --- a/config_other/requirements_el9.txt +++ b/config_other/requirements_el9.txt @@ -18,4 +18,4 @@ aio-pika>=7.1.0 pika>=1.2.0 websockets>=9.0 tzlocal==2.0.0 -ansible-runner==2.3.2 +ansible-runner==2.3.1 diff --git a/requirements.txt b/requirements.txt index 9862767..ecd03fb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,4 +21,4 @@ Flask==2.2.5 Flask-Login==0.6.2 Flask-APScheduler==1.13.0 Flask-Caching==2.1.0 -ansible-runner==2.3.2 +ansible-runner==2.3.1