mirror of https://github.com/Aidaho12/haproxy-wi
v8.1.8: Remove unused code and improve variable naming.
Removed the obsolete `Reconfigure` function from UDP.js and cleaned up unused parameters in config.py. Enhanced logging by simplifying error messages in auth.py and clarified variable naming for HA routes. These changes improve readability and maintainability.pull/418/head
parent
33b18a4a35
commit
c765616b1b
|
@ -159,7 +159,6 @@ def _create_config_version(server_id: int, server_ip: str, service: str, config_
|
|||
:param server_ip: The IP address of the server.
|
||||
:param service: The service name.
|
||||
:param config_path: The path to the configuration file.
|
||||
:param login: The login of the user.
|
||||
:param cfg: The new configuration string.
|
||||
:param old_cfg: The path to the old configuration file.
|
||||
:param tmp_file: A temporary file name.
|
||||
|
@ -442,6 +441,7 @@ def show_config(server_ip: str, service: str, config_file_name: str, configver:
|
|||
"""
|
||||
Get and display the configuration file for a given server.
|
||||
|
||||
:param edit_section:
|
||||
:param claims:
|
||||
:param server_ip: The IP address of the server.
|
||||
:param service: The name of the service.
|
||||
|
|
|
@ -124,7 +124,7 @@ def check_user_password(login: str, password: str) -> dict:
|
|||
try:
|
||||
user = user_sql.get_user_by_username(login)
|
||||
except Exception as e:
|
||||
roxywi_common.logging('Roxy-WI server', f'error: Cannot login user {e}', roxywi=1)
|
||||
roxywi_common.logging('Roxy-WI server', f'error: Cannot login user {e}')
|
||||
raise Exception('ban')
|
||||
if user.enabled == 0:
|
||||
raise Exception('Your login is disabled')
|
||||
|
|
|
@ -165,8 +165,8 @@ def check_cluster_status(service: str, cluster_id: int):
|
|||
statuses = []
|
||||
cmd = f'systemctl is-active keepalived.service'
|
||||
for slave in slaves:
|
||||
status = server_mod.ssh_command(slave[2], cmd)
|
||||
statuses.append(status.replace('\n', '').replace('\r', ''))
|
||||
output = server_mod.ssh_command(slave[2], cmd)
|
||||
statuses.append(output.replace('\n', '').replace('\r', ''))
|
||||
if 'inactive' in statuses and 'active' in statuses:
|
||||
status = 'warning'
|
||||
elif 'inactive' in statuses and 'active' not in statuses:
|
||||
|
|
|
@ -377,22 +377,6 @@ function saveUdpListener(jsonData, dialog_id, listener_id=0, edited=0, reconfigu
|
|||
}
|
||||
});
|
||||
}
|
||||
function Reconfigure(listener_id) {
|
||||
return $.ajax({
|
||||
url: "/install/udp",
|
||||
data: JSON.stringify({listener_id: listener_id}),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
async: false,
|
||||
type: "POST",
|
||||
success: function (data) {
|
||||
if (data.status === 'failed') {
|
||||
toastr.error(data.error);
|
||||
} else {
|
||||
parseAnsibleJsonOutput(data, 'UDP listener', '');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function getUDPListener(listener_id, new_listener=false) {
|
||||
$.ajax({
|
||||
url: "/udp/listener/" + listener_id,
|
||||
|
@ -610,7 +594,7 @@ function checkUdpBackendStatus(listener_id, backend_ip) {
|
|||
toastr.error(data.error);
|
||||
return false;
|
||||
} else {
|
||||
let server_div = $('#backend_server_status_' + backend_ip.replaceAll('.', ''));
|
||||
let server_div = $('#backend_server_status_' +listener_id+ '_' + backend_ip.replaceAll('.', ''));
|
||||
if (data.data === 'yes') {
|
||||
server_div.removeClass('serverNone');
|
||||
server_div.removeClass('serverDown');
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
{% set config = listener.config|string_to_dict %}
|
||||
{% for c in config %}
|
||||
<div>
|
||||
<span id="backend_server_status_{{ c.backend_ip|replace('.', '') }}" class="server-status-small serverNone"></span>
|
||||
<span id="backend_server_status_{{ listener.id }}_{{ c.backend_ip|replace('.', '') }}" class="server-status-small serverNone"></span>
|
||||
{{ lang.words.server|title() }}: {{ copy_to_clipboard(value=c.backend_ip) }}, {{ lang.words.port }}: {{ c.port }}, {{ lang.words.weight }}: {{ c.weight }}
|
||||
</div>
|
||||
<script>
|
||||
|
|
Loading…
Reference in New Issue