mirror of https://github.com/Aidaho12/haproxy-wi
parent
40fa9c06ef
commit
342913a9f9
20
app/funct.py
20
app/funct.py
|
@ -122,8 +122,8 @@ def logging(serv, action, **kwargs):
|
|||
login = ''
|
||||
|
||||
try:
|
||||
subprocess_execute('sudo chown apache:apache -R' + log_path)
|
||||
except:
|
||||
os.system('sudo chown apache:apache -R ' + log_path)
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
if kwargs.get('alerting') == 1:
|
||||
|
@ -587,17 +587,22 @@ def show_installation_output(error, output, service):
|
|||
if error and "WARNING" not in error:
|
||||
logging('localhost', error, haproxywi=1)
|
||||
print('error: '+error)
|
||||
return False
|
||||
else:
|
||||
for l in output:
|
||||
if "Traceback" in l or "FAILED" in l:
|
||||
if "UNREACHABLE" in l:
|
||||
print(l + '<br />')
|
||||
if "Traceback" in l or "FAILED" in l or "error" in l:
|
||||
try:
|
||||
print(l)
|
||||
break
|
||||
return False
|
||||
except Exception:
|
||||
print(output)
|
||||
break
|
||||
else:
|
||||
print('success: ' + service + ' has been installed')
|
||||
return True
|
||||
|
||||
|
||||
def install_haproxy(serv, **kwargs):
|
||||
|
@ -644,10 +649,11 @@ def install_haproxy(serv, **kwargs):
|
|||
service = server_for_installing + ' HAProxy'
|
||||
else:
|
||||
service = ' HAProxy'
|
||||
show_installation_output(error, output, service)
|
||||
|
||||
if show_installation_output(error, output, service):
|
||||
sql.update_haproxy(serv)
|
||||
|
||||
os.system("rm -f %s" % script)
|
||||
sql.update_haproxy(serv)
|
||||
|
||||
|
||||
def waf_install(serv):
|
||||
|
@ -718,10 +724,10 @@ def install_nginx(serv, **kwargs):
|
|||
service = server_for_installing + ' Nginx'
|
||||
else:
|
||||
service = ' Nginx'
|
||||
show_installation_output(error, output, service)
|
||||
if show_installation_output(error, output, service):
|
||||
sql.update_nginx(serv)
|
||||
|
||||
os.system("rm -f %s" % script)
|
||||
sql.update_nginx(serv)
|
||||
|
||||
|
||||
def update_haproxy_wi(service):
|
||||
|
|
|
@ -1058,11 +1058,10 @@ if form.getvalue('master'):
|
|||
|
||||
output, error = funct.subprocess_execute(commands[0])
|
||||
|
||||
funct.show_installation_output(error, output, 'master Keepalived')
|
||||
|
||||
if funct.show_installation_output(error, output, 'master Keepalived'):
|
||||
sql.update_keepalived(master)
|
||||
|
||||
if virt_server is not None:
|
||||
if virt_server != '0':
|
||||
group_id = sql.get_group_id_by_server_ip(master)
|
||||
cred_id = sql.get_cred_id_by_server_ip(master)
|
||||
hostname = sql.get_hostname_by_server_ip(master)
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
{% else %}
|
||||
<div style="text-align: center;">
|
||||
<br />
|
||||
<h3>You do not have installed OpenVPN client.
|
||||
<h3>You have not installed OpenVPN client.
|
||||
Read <a href="https://roxy-wi.org/services.py?service=openvpn" title="OpenVPN" style="color: #5d9ceb;" target="_blank">hear</a>
|
||||
how to install OpenVPN client</h3>
|
||||
</div>
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
{% else %}
|
||||
<div style="text-align: center;">
|
||||
<br />
|
||||
<h3>You do not have installed Backends checker
|
||||
<h3>You have not installed Backends checker
|
||||
Read <a href="https://roxy-wi.org/services.py?service=checker#installation" title="Checker installation" style="color: #5d9ceb;" target="_blank">hear</a>
|
||||
how to install Checker service</h3>
|
||||
</div>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<table class="overview" id="ajax-users">
|
||||
<thead>
|
||||
<tr class="overviewHead">
|
||||
<th class="padding10 first-collumn">Login name</th>
|
||||
<th class="padding10 first-collumn">Login</th>
|
||||
<th style="width: 10%">Password</th>
|
||||
<th style="width: 10%">Active</th>
|
||||
<th style="width: 20%">Email</th>
|
||||
|
@ -52,7 +52,7 @@
|
|||
</td>
|
||||
<td>
|
||||
<select id="role-{{user.user_id}}" name="role-{{user.user_id}}">
|
||||
<option disabled selected>Choose role</option>
|
||||
<option disabled selected>Select a role</option>
|
||||
{% for r in roles %}
|
||||
{% if page == "servers.py" %}
|
||||
{% if r.name != "superAdmin" %}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
{% if services == '0' %}
|
||||
<div style="text-align: center;">
|
||||
<br />
|
||||
<h3>You do not have installed Metrics service.
|
||||
<h3>You have not installed Metrics service.
|
||||
Read <a href="https://roxy-wi.org/services.py?service=metrics#installation" title="Metrics installation" style="color: #5d9ceb;" target="_blank">hear</a>
|
||||
how to install Metrics service</h3>
|
||||
</div>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
{% elif port_scanner_stderr != '' %}
|
||||
<div style="text-align: center;">
|
||||
<br />
|
||||
<h3>You do not have installed Port scanner service. Read <a href="https://roxy-wi.org/services.py?service=port_scanner"
|
||||
<h3>You have not installed Port scanner service. Read <a href="https://roxy-wi.org/services.py?service=port_scanner"
|
||||
title="Port scanner" target="_blank">here</a> how to install Port scanner service</h3>
|
||||
</div>
|
||||
{% else %}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
{% if not is_terraform %}
|
||||
<center>
|
||||
<br />
|
||||
<h3>You do not have installed Terraform. Read <a href="https://www.terraform.io/downloads.html"
|
||||
<h3>You have not installed Terraform. Read <a href="https://www.terraform.io/downloads.html"
|
||||
title="Download Terraform" target="_blank">here</a> how to install Terraform</h3>
|
||||
</center>
|
||||
{% else %}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
{% if smon_error != '' %}
|
||||
<div style="text-align: center;">
|
||||
<br />
|
||||
<h3>You do not have installed SMON service. Read <a href="https://roxy-wi.org/services.py?service=smon"
|
||||
<h3>You have not installed SMON service. Read <a href="https://roxy-wi.org/services.py?service=smon"
|
||||
title="Simple monitoring network ports with alerting via Telegram and WEB panel" target="_blank">here</a> how to install SMON service</h3>
|
||||
</div>
|
||||
{% elif smon_status.0 == 'failed' %}
|
||||
|
@ -19,21 +19,21 @@
|
|||
{% elif smon|length == 0 and action != 'add' and action != 'history' and action != 'checker_history' %}
|
||||
<div style="text-align: center;">
|
||||
<br />
|
||||
<h3>You do not have added servers in SMON service. Create you first server <a href="smon.py?action=add" title="Roxy-WI SMON" target="_blank">here</a> before use</h3>
|
||||
<h3>You do not have added servers in SMON service. Create your first server <a href="smon.py?action=add" title="Roxy-WI SMON" target="_blank">here</a> before use</h3>
|
||||
<br />
|
||||
<iframe width="860" height="515" src="https://www.youtube.com/embed/bJtRJeHG5B0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
</div>
|
||||
{% elif smon|length == 0 and action != 'add' and action == 'history' %}
|
||||
<div style="text-align: center;">
|
||||
<br />
|
||||
<h3>There are not any events yet. Check if there are any checks added <a href="smon.py?action=add" title="Roxy-WI SMON" target="_blank">here</a></h3>
|
||||
<h3>No events added yet. Click here <a href="smon.py?action=add" title="Roxy-WI SMON" target="_blank">here</a> to see if new check have been added</h3>
|
||||
<br />
|
||||
</div>
|
||||
{% elif smon|length == 0 and action != 'add' and action == 'checker_history' %}
|
||||
<div style="text-align: center;">
|
||||
<br />
|
||||
<h3>
|
||||
There are not any events yet. Check if there are any Checker are enabled on the "<a href="hapservers.py" title="HAProxy Overview">HAProxy Overview</a>"
|
||||
No events added yet. Check if there are any Checker are enabled on the "<a href="hapservers.py" title="HAProxy Overview">HAProxy Overview</a>"
|
||||
or on "<a href="hapservers.py?service=nginx" title="Nginx Overview">Nginx Overview</a>" pages
|
||||
</h3>
|
||||
<br />
|
||||
|
|
12
inc/ha.js
12
inc/ha.js
|
@ -101,7 +101,7 @@ function add_master_addr(kp) {
|
|||
type: "POST",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if (data.indexOf('error:') != '-1') {
|
||||
if (data.indexOf('error:') != '-1') || data.indexOf('UNREACHABLE') != '-1') {
|
||||
showProvisioningError(data, '#creating-master-add', '#wait-mess-add', '#creating-error-add');
|
||||
} else if (data == '' ){
|
||||
showProvisioningWarning('#creating-master-add', 'master Keepalived', '#creating-warning-add', '#wait_mess-add');
|
||||
|
@ -125,7 +125,7 @@ function add_slave_addr(kp) {
|
|||
type: "POST",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if (data.indexOf('error:') != '-1') {
|
||||
if (data.indexOf('error:') != '-1') || data.indexOf('UNREACHABLE') != '-1') {
|
||||
showProvisioningError(data, '#creating-slave-add', '#wait-mess-add', '#creating-error-add');
|
||||
} else if (data == '' ){
|
||||
showProvisioningWarning('#creating-slave-add', 'master Keepalived', '#creating-warning-add', '#wait_mess-add');
|
||||
|
@ -163,7 +163,7 @@ function create_master_keepalived(hap, nginx, syn_flood) {
|
|||
type: "POST",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') || data.indexOf('UNREACHABLE') != '-1') {
|
||||
showProvisioningError(data, '#creating-master', '#wait-mess', '#creating-error');
|
||||
} else if (data == '' ){
|
||||
showProvisioningWarning(step_id, 'master Keepalived', '#creating-warning', '#wait_mess');
|
||||
|
@ -205,7 +205,7 @@ function create_slave_keepalived(hap, nginx, syn_flood) {
|
|||
type: "POST",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') || data.indexOf('UNREACHABLE') != '-1') {
|
||||
showProvisioningError(data, '#creating-slave', '#wait-mess', '#creating-error');
|
||||
} else if (data == '' ){
|
||||
showProvisioningWarning(step_id, 'slave Keepalived', '#creating-warning', '#wait_mess');
|
||||
|
@ -249,7 +249,7 @@ function create_keep_alived_hap(nginx, server) {
|
|||
type: "POST",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') || data.indexOf('UNREACHABLE') != '-1') {
|
||||
showProvisioningError(data, step_id, '#wait-mess', '#creating-error');
|
||||
} else if (data == '' ){
|
||||
showProvisioningWarning(step_id, install_step, '#creating-warning', '#wait_mess');
|
||||
|
@ -285,7 +285,7 @@ function create_keep_alived_nginx(server) {
|
|||
type: "POST",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') || data.indexOf('UNREACHABLE') != '-1') {
|
||||
showProvisioningError(data, step_id, '#wait-mess', '#creating-error');
|
||||
} else if (data == '' ){
|
||||
showProvisioningWarning(step_id, install_step, '#creating-warning', '#wait_mess');
|
||||
|
|
20
inc/users.js
20
inc/users.js
|
@ -77,7 +77,7 @@ $( function() {
|
|||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
$("#ajax").html('')
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') || data.indexOf('UNREACHABLE') != '-1') {
|
||||
toastr.error(data);
|
||||
} else if (data.indexOf('success') != '-1' ){
|
||||
toastr.remove();
|
||||
|
@ -111,7 +111,7 @@ $( function() {
|
|||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
$("#ajax").html('')
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') || data.indexOf('UNREACHABLE') != '-1') {
|
||||
toastr.clear();
|
||||
toastr.error(data);
|
||||
} else if (data.indexOf('success') != '-1' ){
|
||||
|
@ -141,7 +141,7 @@ $( function() {
|
|||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
$("#ajaxmon").html('');
|
||||
if (data.indexOf('FAILED') != '-1') {
|
||||
if (data.indexOf('FAILED') != '-1') || data.indexOf('UNREACHABLE') != '-1') {
|
||||
toastr.clear();
|
||||
toastr.error(data);;
|
||||
} else if (data.indexOf('success') != '-1' ){
|
||||
|
@ -170,7 +170,7 @@ $( function() {
|
|||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
$("#ajaxmon").html('');
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') || data.indexOf('UNREACHABLE') != '-1') {
|
||||
toastr.clear();
|
||||
toastr.error(data);
|
||||
} else if (data.indexOf('success') != '-1' ){
|
||||
|
@ -202,7 +202,7 @@ $( function() {
|
|||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
$("#ajaxmon").html('');
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') || data.indexOf('UNREACHABLE') != '-1') {
|
||||
toastr.error(data);
|
||||
} else if (data.indexOf('success') != '-1' ){
|
||||
toastr.clear();
|
||||
|
@ -233,7 +233,7 @@ $( function() {
|
|||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
$("#ajaxmon").html('');
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') || data.indexOf('UNREACHABLE') != '-1') {
|
||||
toastr.error(data);
|
||||
} else if (data.indexOf('success') != '-1' ){
|
||||
toastr.clear();
|
||||
|
@ -1525,16 +1525,22 @@ function updateUser(id) {
|
|||
toastr.remove();
|
||||
cur_url[0] = cur_url[0].split('#')[0]
|
||||
var usergroup = Cookies.get('group');
|
||||
var role = $('#role-'+id).val();
|
||||
var activeuser = 0;
|
||||
if ($('#activeuser-'+id).is(':checked')) {
|
||||
activeuser = '1';
|
||||
}
|
||||
if (role == null){
|
||||
toastr.warning('Please edit this user only on the Admin area');
|
||||
return false;
|
||||
}
|
||||
toastr.remove();
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
updateuser: $('#login-'+id).val(),
|
||||
email: $('#email-'+id).val(),
|
||||
role: $('#role-'+id).val(),
|
||||
role: role,
|
||||
usergroup: usergroup,
|
||||
activeuser: activeuser,
|
||||
id: id,
|
||||
|
|
Loading…
Reference in New Issue