v8.2.0.4: bug fix. add new HAProxy versions

master
Aidaho 2025-05-24 09:14:19 +03:00
parent 3c57a863c8
commit 420694793d
10 changed files with 29 additions and 9 deletions

View File

@ -7,7 +7,7 @@ migrator = connect(get_migrator=1)
def up(): def up():
"""Apply the migration.""" """Apply the migration."""
try: try:
Version.update(version='8.2.0.3').execute() Version.update(version='8.2.0.4').execute()
except Exception as e: except Exception as e:
print(f"Error updating version: {str(e)}") print(f"Error updating version: {str(e)}")
raise e raise e

View File

@ -25,6 +25,7 @@ class EscapedString(str):
return field_value return field_value
else: else:
return quote(field_value.rstrip()) return quote(field_value.rstrip())
return field_value
@classmethod @classmethod
def __get_pydantic_core_schema__( def __get_pydantic_core_schema__(
@ -232,6 +233,7 @@ class ChannelRequest(BaseModel):
class ServerInstall(BaseModel): class ServerInstall(BaseModel):
id: int id: int
master: Optional[bool] = 0 master: Optional[bool] = 0
version: Optional[str] = '3.1.7-1'
class ServiceInstall(BaseModel): class ServiceInstall(BaseModel):
@ -616,14 +618,14 @@ class NginxLocationRequest(BaseModel):
class NginxProxyPassRequest(BaseModel): class NginxProxyPassRequest(BaseModel):
locations: List[NginxLocationRequest] locations: List[NginxLocationRequest]
name: EscapedString name: Union[IPvAnyAddress, DomainName]
port: Annotated[int, Gt(1), Le(65535)] port: Annotated[int, Gt(1), Le(65535)]
type: Literal['proxy_pass'] = 'proxy_pass' type: Literal['proxy_pass'] = 'proxy_pass'
scheme: Literal['http', 'https'] = 'http' scheme: Literal['http', 'https'] = 'http'
ssl_crt: Optional[str] = None ssl_crt: Optional[str] = None
ssl_key: Optional[str] = None ssl_key: Optional[str] = None
ssl_offloading: Optional[bool] = False ssl_offloading: Optional[bool] = False
action: Optional[Literal['save', 'test', 'reload', 'restart']] = 'save' action: Optional[Literal['save', 'test', 'reload', 'restart']] = 'reload'
compression: bool = False compression: bool = False
compression_level: Annotated[int, Gt(0), Le(10)] = 6 compression_level: Annotated[int, Gt(0), Le(10)] = 6
compression_min_length: Optional[int] = 1024 compression_min_length: Optional[int] = 1024

View File

@ -130,8 +130,13 @@ def show_roxy_log(
if serv == 'backup.log': if serv == 'backup.log':
awk_column = 2 awk_column = 2
if serv == 'roxy-wi.log':
cmd = (f"awk -F'\"' -v t_start=\"{date}:00\" -v t_end=\"{date1}:00\" '{{for(i=1;i<NF;i++) if($i==\"timestamp\"){{split($(i+2),d,\"T\"); "
f"if(d[2]>=t_start && d[2]<=t_end) print; break}}}}' {log_path}/roxy-wi.log"
f"{user_grep} {grep_act} {exgrep_act} |tail -{rows}")
else:
cmd = f"cat {log_path}/{serv}| awk '${awk_column}>\"{date}:00\" && ${awk_column}<\"{date1}:00\"' {user_grep} {grep_act} {exgrep_act} |tail -{rows}" cmd = f"cat {log_path}/{serv}| awk '${awk_column}>\"{date}:00\" && ${awk_column}<\"{date1}:00\"' {user_grep} {grep_act} {exgrep_act} |tail -{rows}"
output, stderr = server_mod.subprocess_execute(cmd) output, stderr = server_mod.subprocess_execute(cmd)
return show_log(output, grep=grep) return show_log(output, grep=grep)
return ''

View File

@ -127,7 +127,7 @@ def generate_haproxy_inv(json_data: ServiceInstall, installed_service: str) -> o
stats_password = sql.get_setting('haproxy_stats_password') stats_password = sql.get_setting('haproxy_stats_password')
haproxy_dir = sql.get_setting('haproxy_dir') haproxy_dir = sql.get_setting('haproxy_dir')
container_name = sql.get_setting('haproxy_container_name') container_name = sql.get_setting('haproxy_container_name')
haproxy_ver = '3.1.1-1' haproxy_ver = json_data['servers'][0]['version']
is_docker = json_data['services']['haproxy']['docker'] is_docker = json_data['services']['haproxy']['docker']
for v in json_data['servers']: for v in json_data['servers']:

View File

@ -86,6 +86,7 @@
- socat - socat
- rsyslog - rsyslog
state: present state: present
update_cache: yes
when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu' when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu'
environment: environment:
http_proxy: "{{PROXY}}" http_proxy: "{{PROXY}}"

View File

@ -100,6 +100,7 @@
- make - make
- git - git
state: present state: present
update_cache: yes
when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu' when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu'
environment: environment:
http_proxy: "{{PROXY}}" http_proxy: "{{PROXY}}"

View File

@ -69,6 +69,7 @@
- zlib1g - zlib1g
- zlib1g-dev - zlib1g-dev
state: present state: present
update_cache: yes
when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu' when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu'
environment: environment:
http_proxy: "{{PROXY}}" http_proxy: "{{PROXY}}"

View File

@ -291,11 +291,19 @@ function delete_section(section_type, section_name, server_id, service) {
method: "DELETE", method: "DELETE",
statusCode: { statusCode: {
204: function (xhr) { 204: function (xhr) {
if (service === 'nginx') {
window.open('/config/' + service + '/' + $('#serv').val() + '/show-files', '_self')
} else {
showConfig(); showConfig();
}
}, },
404: function (xhr) { 404: function (xhr) {
if (service === 'nginx') {
window.open('/config/' + service + '/' + $('#serv').val() + '/show-files', '_self')
} else {
showConfig(); showConfig();
} }
}
}, },
success: function (data) { success: function (data) {
if (data) { if (data) {
@ -758,6 +766,7 @@ function openNginxSection(section) {
} }
} }
} }
$('#location').val(location.location);
$('#proxy_connect_timeout').val(location.proxy_connect_timeout); $('#proxy_connect_timeout').val(location.proxy_connect_timeout);
$('#proxy_read_timeout').val(location.proxy_read_timeout); $('#proxy_read_timeout').val(location.proxy_read_timeout);
$('#proxy_send_timeout').val(location.proxy_send_timeout); $('#proxy_send_timeout').val(location.proxy_send_timeout);

View File

@ -26,6 +26,7 @@
<script src="/static/js/codemirror/keymap/sublime.js"></script> <script src="/static/js/codemirror/keymap/sublime.js"></script>
<script src="/static/js/configshow.js"></script> <script src="/static/js/configshow.js"></script>
<script src="/static/js/add.js"></script> <script src="/static/js/add.js"></script>
<script src="/static/js/add_nginx.js"></script>
<script src="/static/js/edit_config.js"></script> <script src="/static/js/edit_config.js"></script>
{% if is_serv_protected and g.user_params['role'] > 2 %} {% if is_serv_protected and g.user_params['role'] > 2 %}
<meta http-equiv="refresh" content="0; url=/service"> <meta http-equiv="refresh" content="0; url=/service">

View File

@ -39,7 +39,7 @@
</td> </td>
<td class="padding10 first-collumn" style="width: 20%;"> <td class="padding10 first-collumn" style="width: 20%;">
{% set values = dict() %} {% set values = dict() %}
{% set values = {'2.6.14-1':'2.6.14-1','2.7.9-1':'2.7.9-1','2.8.1-1':'2.8.1-1','2.9.6-1':'2.9.6-1','3.0.3-1':'3.0.3-1','3.1.1-1':'3.1.1-1'} %} {% set values = {'2.6.14-1':'2.6.14-1','2.7.9-1':'2.7.9-1','2.8.1-1':'2.8.1-1','2.9.6-1':'2.9.6-1','3.0.10-1':'3.0.10-1','3.1.7-1':'3.1.7-1'} %}
{{ select('hapver', values=values, selected='3.1.1-1', required='required') }} {{ select('hapver', values=values, selected='3.1.1-1', required='required') }}
</td> </td>
<td class="padding10 first-collumn"> <td class="padding10 first-collumn">