v8.1.8: Remove HAProxy enterprise support.

Removed all references to HAProxy enterprise functionality from the codebase, including UI elements, backend logic, and service settings. Standardized status key casing across files and improved error handling in `_service_status` method.
pull/418/head v8.1.8
Aidaho 2025-05-10 18:47:53 +03:00
parent ea5ee37b8c
commit da34363cb4
5 changed files with 14 additions and 54 deletions

View File

@ -24,10 +24,6 @@ def get_correct_service_name(service: str, server_id: int) -> str:
*prise is set to '1' in the database for the given server ID. If true, it returns "hapee-2.0-lb". If the service name is 'apache', it calls the get_correct_apache_service_name() method
* with parameters 0 and the server ID to get the correct apache service name. If none of the conditions match, it will return the original service name.
"""
if service == 'haproxy':
haproxy_enterprise = service_sql.select_service_setting(server_id, 'haproxy', 'haproxy_enterprise')
if haproxy_enterprise == '1':
return "hapee-2.0-lb"
if service == 'apache':
return get_correct_apache_service_name(0, server_id)

View File

@ -223,7 +223,6 @@ def show_service_settings(service, server_id):
@check_services
def save_service_settings(service):
server_id = int(request.form.get('serverSettingsSave'))
haproxy_enterprise = int(request.form.get('serverSettingsEnterprise'))
service_dockerized = int(request.form.get('serverSettingsDockerized'))
service_restart = int(request.form.get('serverSettingsRestart'))
server_ip = server_sql.get_server(server_id).ip
@ -232,15 +231,6 @@ def save_service_settings(service):
disable_restart = f'Restart option is disabled for {service.title()} service'
enable_restart = f'Restart option is disabled for {service.title()} service'
if service == 'haproxy':
if service_sql.insert_or_update_service_setting(server_id, service, 'haproxy_enterprise', haproxy_enterprise):
if haproxy_enterprise == '1':
roxywi_common.logging(server_ip, 'Service has been flagged as an Enterprise version',
keep_history=1, service=service)
else:
roxywi_common.logging(server_ip, 'Service has been flagged as a community version',
keep_history=1, service=service)
if service_sql.insert_or_update_service_setting(server_id, service, 'dockerized', service_dockerized):
if service_dockerized == '1':
roxywi_common.logging(server_ip, service_docker, keep_history=1, service=service)

View File

@ -436,12 +436,8 @@ function serverSettings(id, name) {
});
}
function serverSettingsSave(id, name, service, dialog_id) {
let haproxy_enterprise = 0;
let service_dockerized = 0;
let service_restart = 0;
if ($('#haproxy_enterprise').is(':checked')) {
haproxy_enterprise = '1';
}
if ($('#haproxy_dockerized').is(':checked')) {
service_dockerized = '1';
}
@ -464,7 +460,6 @@ function serverSettingsSave(id, name, service, dialog_id) {
url: "/service/settings/" + service,
data: {
serverSettingsSave: id,
serverSettingsEnterprise: haproxy_enterprise,
serverSettingsDockerized: service_dockerized,
serverSettingsRestart: service_restart,
token: $('#token').val()
@ -522,7 +517,7 @@ function check_service_status(id, ip, service) {
server_div.removeClass('div-server-head-up');
server_div.addClass('div-server-head-down');
} else {
if (data.Status === 'running') {
if (data.status === 'running') {
server_div.addClass('div-server-head-up');
server_div.removeClass('div-server-head-down');
server_div.removeClass('div-server-head-unknown');

View File

@ -1,33 +1,6 @@
{% from 'include/input_macros.html' import checkbox %}
{% set nice_service_name = {'haproxy': 'HAProxy', 'nginx': 'NGINX', 'apache': 'Apache'} %}
<table class="overview">
{% if service == 'haproxy' %}
{% if settings %}
{% for s in settings %}
{% if s.haproxy_enterprise != '' and s.setting == 'haproxy_enterprise' %}
<tr>
<td class="padding20 help_cursor" style="width: 70%"
title="If you use enterprise HAProxy, check this. The name of the service will be changed as it is required for the commercial version">HAProxy Enterprise</td>
<td>
{% if s.value == '1' and s.setting == 'haproxy_enterprise' %}
{{ checkbox('haproxy_enterprise', checked='checked', title='This server uses HAProxy enterprise') }}
{% elif s.setting == 'haproxy_enterprise' %}
{{ checkbox('haproxy_enterprise', title='This server uses HAProxy community') }}
{% endif %}
</td>
</tr>
{% endif %}
{% endfor %}
{% else %}
<tr>
<td class="padding20 help_cursor" style="width: 70%"
title="If you use enterprise HAProxy, check this. The name of the service will be changed as it is required for the commercial version">HAProxy Enterprise</td>
<td>
{{ checkbox('haproxy_enterprise', title='This server uses HAProxy community') }}
</td>
</tr>
{% endif %}
{% endif %}
{% if settings %}
{% for s in settings %}
{% if s.dockerized != '' and s.setting == 'dockerized' %}

View File

@ -102,7 +102,7 @@ class ServiceView(MethodView):
if len(data) == 0:
data = ErrorResponse(error='Cannot get information').model_dump(mode='json')
else:
data['Status'] = self._service_status(data['Process'])
data['status'] = self._service_status(data['Process'])
data['auto_start'] = int(server.haproxy_active)
data['checker'] = int(server.haproxy_alert)
data['metrics'] = int(server.haproxy_metrics)
@ -121,9 +121,15 @@ class ServiceView(MethodView):
out1 = out.split('\r')
if out1[0] == 'from':
out1[0] = ''
out1[1] = out1[1].split(')')[1]
try:
out1[1] = out1[1].split(')')[1]
except Exception:
out1 = ['', '', '0']
else:
out1[0] = out1[0].split('/')[1]
try:
out1[0] = out1[0].split('/')[1]
except Exception:
out1 = ['', '', '0']
else:
cmd = ("/usr/sbin/nginx -v 2>&1|awk '{print $3}' && systemctl status nginx |grep -e 'Active'"
"|awk '{print $2, $9$10$11$12$13}' && ps ax |grep nginx:|grep -v grep |wc -l")
@ -146,7 +152,7 @@ class ServiceView(MethodView):
"Version": out1[0],
"Uptime": out1[1],
"Process": out1[2],
"Status": self._service_status(out1[2])}
"status": self._service_status(out1[2])}
except IndexError:
return ErrorResponse(error='NGINX service not found').model_dump(mode='json'), 404
except Exception as e:
@ -172,14 +178,14 @@ class ServiceView(MethodView):
"Version": servers_with_status[0][0].split('/')[1].split(' ')[0],
"Uptime": servers_with_status[0][1].split(':')[1].strip(),
"Process": servers_with_status[0][2].split(' ')[1],
"Status": self._service_status(servers_with_status[0][2].split(' ')[1])
"status": self._service_status(servers_with_status[0][2].split(' ')[1])
}
except IndexError:
data = {
"Version": '',
"Uptime": '',
"Process": 0,
"Status": self._service_status('0')
"status": self._service_status('0')
}
except Exception as e:
data = ErrorResponse(error=str(e)).model_dump(mode='json')
@ -196,7 +202,7 @@ class ServiceView(MethodView):
out1 = out.split()
if out1[0].split('\r')[0] == '/usr/sbin/keepalived:':
return ErrorResponse(error='Keepalived service not found').model_dump(mode='json'), 404
data = {"Version": out1[0].split('\r')[0], "Uptime": out1[2], "Process": out1[3], 'Status': self._service_status(out1[3])}
data = {"Version": out1[0].split('\r')[0], "Uptime": out1[2], "Process": out1[3], 'status': self._service_status(out1[3])}
except IndexError:
return ErrorResponse(error='Keepalived service not found').model_dump(mode='json'), 404
except Exception as e: