mirror of https://github.com/Aidaho12/haproxy-wi
parent
ec9084c7ce
commit
3ed145aac4
|
@ -121,7 +121,7 @@ def delete_cluster(cluster_id: int) -> str:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(f'error: Cannot update master on slave {slave_ip}: {e}')
|
raise Exception(f'error: Cannot update master on slave {slave_ip}: {e}')
|
||||||
|
|
||||||
roxywi_common.logging(cluster_id, f'Cluster has been deleted', keep_history=1, roxywi=1, service='HA cluster')
|
roxywi_common.logging(cluster_id, 'Cluster has been deleted', keep_history=1, roxywi=1, service='HA cluster')
|
||||||
|
|
||||||
return 'ok'
|
return 'ok'
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,8 @@ def generate_service_inv(json_data: json, install_service: str) -> object:
|
||||||
|
|
||||||
|
|
||||||
def run_ansible(inv: object, server_ips: str, ansible_role: str, service: str) -> object:
|
def run_ansible(inv: object, server_ips: str, ansible_role: str, service: str) -> object:
|
||||||
inventory = f'/var/www/haproxy-wi/app/scripts/ansible/inventory/{ansible_role}.json'
|
inventory_path = '/var/www/haproxy-wi/app/scripts/ansible/inventory'
|
||||||
|
inventory = f'{inventory_path}/{ansible_role}.json'
|
||||||
proxy = sql.get_setting('proxy')
|
proxy = sql.get_setting('proxy')
|
||||||
proxy_serv = ''
|
proxy_serv = ''
|
||||||
tags = ''
|
tags = ''
|
||||||
|
@ -346,10 +347,7 @@ def run_ansible(inv: object, server_ips: str, ansible_role: str, service: str) -
|
||||||
'ANSIBLE_DISPLAY_OK_HOSTS': 'no',
|
'ANSIBLE_DISPLAY_OK_HOSTS': 'no',
|
||||||
'ANSIBLE_SHOW_CUSTOM_STATS': 'no',
|
'ANSIBLE_SHOW_CUSTOM_STATS': 'no',
|
||||||
'ANSIBLE_DISPLAY_SKIPPED_HOSTS': "no",
|
'ANSIBLE_DISPLAY_SKIPPED_HOSTS': "no",
|
||||||
'ANSIBLE_CALLBACK_PLUGINS': "/var/www/haproxy-wi/app/scripts/ansible/callback_plugins",
|
'ANSIBLE_DEPRECATION_WARNINGS': "no",
|
||||||
'ANSIBLE_CALLBACKS_ENABLED': "roxywi",
|
|
||||||
'ANSIBLE_STDOUT_CALLBACK': "roxywi",
|
|
||||||
'ORIGINAL_STDOUT_CALLBACK': "roxywi",
|
|
||||||
'ANSIBLE_HOST_KEY_CHECKING': "no",
|
'ANSIBLE_HOST_KEY_CHECKING': "no",
|
||||||
'ACTION_WARNINGS': "no",
|
'ACTION_WARNINGS': "no",
|
||||||
'LOCALHOST_WARNING': "no",
|
'LOCALHOST_WARNING': "no",
|
||||||
|
@ -368,6 +366,9 @@ def run_ansible(inv: object, server_ips: str, ansible_role: str, service: str) -
|
||||||
if os.path.isfile(inventory):
|
if os.path.isfile(inventory):
|
||||||
os.remove(inventory)
|
os.remove(inventory)
|
||||||
|
|
||||||
|
if not os.path.isdir(inventory_path):
|
||||||
|
os.makedirs(inventory_path)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(inventory, 'a') as invent:
|
with open(inventory, 'a') as invent:
|
||||||
invent.write(str(inv))
|
invent.write(str(inv))
|
||||||
|
|
|
@ -429,7 +429,13 @@ function installServiceCluster(jsonData, service, progress_step) {
|
||||||
jsonData: JSON.stringify(jsonData),
|
jsonData: JSON.stringify(jsonData),
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
checkInstallResp(data, servers['cluster_id'], progress_step, servers["name"], li_id, nice_service_name[service]);
|
try {
|
||||||
|
if (data.indexOf('error:') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
checkInstallResp(data, servers['cluster_id'], progress_step, servers["name"], li_id, nice_service_name[service]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
92
inc/users.js
92
inc/users.js
|
@ -7,42 +7,6 @@ $( function() {
|
||||||
var cancel_word = $('#translate').attr('data-cancel');
|
var cancel_word = $('#translate').attr('data-cancel');
|
||||||
$( "#backup_tabs" ).tabs();
|
$( "#backup_tabs" ).tabs();
|
||||||
$('#install').click(function() {
|
$('#install').click(function() {
|
||||||
// $("#ajax").html('')
|
|
||||||
// var syn_flood = 0;
|
|
||||||
// var docker = 0;
|
|
||||||
// var jsonData = {'servers': {'0': {}}, 'services': {'haproxy': {}}};
|
|
||||||
// if ($('#syn_flood').is(':checked')) {
|
|
||||||
// syn_flood = '1';
|
|
||||||
// }
|
|
||||||
// if ($('#haproxy_docker').is(':checked')) {
|
|
||||||
// docker = '1';
|
|
||||||
// }
|
|
||||||
// if ($('#haproxyaddserv').val() == '------' || $('#haproxyaddserv').val() === null) {
|
|
||||||
// var select_server = $('#translate').attr('data-select_server');
|
|
||||||
// toastr.warning(select_server);
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
// jsonData['syn_flood'] = syn_flood;
|
|
||||||
// jsonData['servers']['0']['ip'] = $('#haproxyaddserv').val();
|
|
||||||
// jsonData['servers']['0']['master'] = '0';
|
|
||||||
// jsonData['servers']['0']['name'] = $('#haproxyaddserv option:selected').text();
|
|
||||||
// jsonData['servers']['0']['version'] = $('#hapver option:selected').val();
|
|
||||||
// jsonData['services']['haproxy']['enabled'] = 1;
|
|
||||||
// jsonData['services']['haproxy']['docker'] = docker;
|
|
||||||
// $("#ajax").html(wait_mess);
|
|
||||||
// $.ajax({
|
|
||||||
// url: "/app/install/haproxy/" + $('#haproxyaddserv').val(),
|
|
||||||
// data: {
|
|
||||||
// jsonData: JSON.stringify(jsonData),
|
|
||||||
// token: $('#token').val()
|
|
||||||
// },
|
|
||||||
// type: "POST",
|
|
||||||
// success: function (data) {
|
|
||||||
// data = data.replace(/\s+/g, ' ');
|
|
||||||
// parseAnsibleJsonOutput(data, 'HAProxy');
|
|
||||||
// $("#haproxyaddserv").trigger("selectmenuchange");
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
installService('haproxy')
|
installService('haproxy')
|
||||||
});
|
});
|
||||||
$('#nginx_install').click(function() {
|
$('#nginx_install').click(function() {
|
||||||
|
@ -2911,57 +2875,17 @@ function installService(service) {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
// data = data.replace(/\s+/g, ' ');
|
try {
|
||||||
parseAnsibleJsonOutput(data, nice_names[service]);
|
if (data.indexOf('error:') != '-1') {
|
||||||
$("#" + service + "yaddserv").trigger("selectmenuchange");
|
toastr.error(data);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
parseAnsibleJsonOutput(data, nice_names[service]);
|
||||||
|
$("#" + service + "yaddserv").trigger("selectmenuchange");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// function installService(service) {
|
|
||||||
// $("#ajax").html('')
|
|
||||||
// var syn_flood = 0;
|
|
||||||
// var docker = 0;
|
|
||||||
// if ($('#' + service + '_syn_flood').is(':checked')) {
|
|
||||||
// syn_flood = '1';
|
|
||||||
// }
|
|
||||||
// if ($('#' + service + '_docker').is(':checked')) {
|
|
||||||
// docker = '1';
|
|
||||||
// }
|
|
||||||
// if ($('#' + service + 'addserv').val() == '------') {
|
|
||||||
// var select_server = $('#translate').attr('data-select_server');
|
|
||||||
// toastr.warning(select_server);
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
// $("#ajax").html(wait_mess);
|
|
||||||
// $.ajax({
|
|
||||||
// url: "/app/install/" + service + "/" + $('#' + service + 'addserv').val(),
|
|
||||||
// data: {
|
|
||||||
// syn_flood: syn_flood,
|
|
||||||
// docker: docker,
|
|
||||||
// token: $('#token').val()
|
|
||||||
// },
|
|
||||||
// type: "POST",
|
|
||||||
// success: function (data) {
|
|
||||||
// data = data.replace(/\s+/g, ' ');
|
|
||||||
// $("#ajax").html('')
|
|
||||||
// if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1' || data.indexOf('UNREACHABLE') != '-1') {
|
|
||||||
// toastr.clear();
|
|
||||||
// var p_err = show_pretty_ansible_error(data);
|
|
||||||
// toastr.error(p_err);
|
|
||||||
// } else if (data.indexOf('success') != '-1') {
|
|
||||||
// toastr.clear();
|
|
||||||
// toastr.success(data);
|
|
||||||
// $('#' + service + 'addserv').trigger("selectmenuchange");
|
|
||||||
// } else if (data.indexOf('Info') != '-1') {
|
|
||||||
// toastr.clear();
|
|
||||||
// toastr.info(data);
|
|
||||||
// } else {
|
|
||||||
// toastr.clear();
|
|
||||||
// toastr.info(data);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
function showServiceVersion(service) {
|
function showServiceVersion(service) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/app/install/" + service + "/version/" + $('#' + service + 'addserv option:selected').val(),
|
url: "/app/install/" + service + "/version/" + $('#' + service + 'addserv option:selected').val(),
|
||||||
|
|
Loading…
Reference in New Issue