diff --git a/app/modules/db/ha_cluster.py b/app/modules/db/ha_cluster.py index 3fc2371a..0455c255 100644 --- a/app/modules/db/ha_cluster.py +++ b/app/modules/db/ha_cluster.py @@ -65,6 +65,8 @@ def select_cluster_vip(cluster_id: int, router_id: int) -> HaClusterVip: def select_cluster_vip_by_vip_id(cluster_id: int, vip_id: int) -> HaClusterVip: try: return HaClusterVip.get((HaClusterVip.cluster_id == cluster_id) & (HaClusterVip.id == vip_id)) + except HaClusterVip.DoesNotExist: + raise RoxywiResourceNotFound except Exception as e: out_error(e) diff --git a/app/modules/roxywi/class_models.py b/app/modules/roxywi/class_models.py index c7da7b19..4ba4a555 100644 --- a/app/modules/roxywi/class_models.py +++ b/app/modules/roxywi/class_models.py @@ -207,9 +207,8 @@ class ChannelRequest(BaseModel): class ServerInstall(BaseModel): - ip: Union[IPvAnyAddress, DomainName] + id: int master: Optional[bool] = 0 - name: EscapedString class ServiceInstall(BaseModel): diff --git a/app/modules/service/ha_cluster.py b/app/modules/service/ha_cluster.py index efc19b3b..263f156e 100644 --- a/app/modules/service/ha_cluster.py +++ b/app/modules/service/ha_cluster.py @@ -284,7 +284,7 @@ def _create_or_update_master_slaves_servers(cluster_id: int, servers: dict, rout roxywi_common.logging(cluster_id, f'New server {s.hostname} has been added to the cluster', keep_history=1, roxywi=1, service='HA cluster') except Exception as e: - raise Exception(f'error: Cannot update slave server {server["ip"]}: {e}') + raise Exception(f'error: Cannot update slave server {s.hostname}: {e}') if server['master']: continue diff --git a/app/static/js/install.js b/app/static/js/install.js index 79e5b714..41e11824 100644 --- a/app/static/js/install.js +++ b/app/static/js/install.js @@ -151,9 +151,10 @@ function installService(service) { } let jsonData = {}; let server = { - "ip": $(select_id).val(), + // "ip": $(select_id).val(), "master": '0', - "name": $(select_id + ' option:selected').text(), + "id": $(select_id + ' option:selected').attr('data-id'), + // "name": $(select_id + ' option:selected').text(), } if (service === 'haproxy') { server['version'] = $('#hapver option:selected').val(); diff --git a/app/templates/install.html b/app/templates/install.html index 461b40af..c79181f2 100644 --- a/app/templates/install.html +++ b/app/templates/install.html @@ -46,7 +46,7 @@ @@ -81,7 +81,7 @@ @@ -116,7 +116,7 @@ @@ -223,8 +223,8 @@