diff --git a/api/api_funct.py b/api/api_funct.py
index 00e58c35..60e58cc7 100644
--- a/api/api_funct.py
+++ b/api/api_funct.py
@@ -230,7 +230,7 @@ def get_all_statuses():
login, group_id, role_id = sql.get_username_groupid_from_api_token(token)
sock_port = sql.get_setting('haproxy_sock_port')
- for s in servers:
+ for _s in servers:
servers = roxywi_common.get_dick_permit(username=login, group_id=group_id, token=token)
for s in servers:
@@ -848,14 +848,16 @@ def create_ha_cluster():
data = {'status': dict()}
try:
- ha_cluster.create_cluster(json_loads, group_id)
+ cluster_id = ha_cluster.create_cluster(json_loads, group_id)
except Exception as e:
data['status'] = f'error: Cannot create HA cluster: {e}'
return data['status']
else:
data['status'].setdefault('cluster', 'done')
try:
- service_mod.install_service('keepalived', body)
+ json_loads['cluster_id'] = cluster_id
+ json_dump = json.dumps(json_loads)
+ service_mod.install_service('keepalived', json_dump)
except Exception as e:
data['status'].setdefault('keepalived', f'error: {e}')
else:
diff --git a/app/modules/roxywi/logs.py b/app/modules/roxywi/logs.py
index b760b148..0f2758b3 100644
--- a/app/modules/roxywi/logs.py
+++ b/app/modules/roxywi/logs.py
@@ -73,22 +73,18 @@ def show_roxy_log(
if service in ('nginx', 'haproxy', 'apache', 'keepalived'):
syslog_server_enable = sql.get_setting('syslog_server_enable')
if syslog_server_enable is None or syslog_server_enable == 0:
+ local_path_logs = sql.get_setting(f'{service}_path_logs')
if service == 'nginx':
- local_path_logs = sql.get_setting('nginx_path_logs')
commands = ["sudo cat %s/%s |tail -%s %s %s" % (local_path_logs, log_file, rows, grep_act, exgrep_act)]
elif service == 'apache':
- local_path_logs = sql.get_setting('apache_path_logs')
commands = [
"sudo cat %s/%s| awk -F\"/|:\" '$3>\"%s:00\" && $3<\"%s:00\"' |tail -%s %s %s" % (local_path_logs, log_file, date, date1, rows, grep_act, exgrep_act)
]
elif service == 'keepalived':
- local_path_logs = sql.get_setting('keepalived_path_logs')
commands = [
- "sudo cat %s/%s| awk '$3>\"%s:00\" && $3<\"%s:00\"' |tail -%s %s %s" % (
- local_path_logs, log_file, date, date1, rows, grep_act, exgrep_act)
+ "sudo cat %s/%s| awk '$3>\"%s:00\" && $3<\"%s:00\"' |tail -%s %s %s" % (local_path_logs, log_file, date, date1, rows, grep_act, exgrep_act)
]
else:
- local_path_logs = sql.get_setting('haproxy_path_logs')
commands = ["sudo cat %s/%s| awk '$3>\"%s:00\" && $3<\"%s:00\"' |tail -%s %s %s" % (local_path_logs, log_file, date, date1, rows, grep_act, exgrep_act)]
syslog_server = serv
diff --git a/inc/nettools.js b/inc/nettools.js
index efdff742..733a548f 100644
--- a/inc/nettools.js
+++ b/inc/nettools.js
@@ -86,6 +86,13 @@ $( function() {
url: frm.attr('action'),
data: frm.serialize() + "&nettools_action=" + $(this).val(),
type: frm.attr('method'),
+ xhrFields: {
+ onprogress: function (e) {
+ console.log(e.currentTarget.responseText);
+ $('#ajax-nettools').html(e.currentTarget.responseText);
+ }
+ },
+ dataType: 'text',
success: function (data) {
data = data.replace('\n', "
");
if (data.indexOf('error: ') != '-1' || data.indexOf('Fatal') != '-1' || data.indexOf('Error(s)') != '-1') {
@@ -96,7 +103,6 @@ $( function() {
toastr.warning(data)
} else {
toastr.clear();
- $('#ajax-nettools').html('