mirror of https://github.com/Aidaho12/haproxy-wi
parent
eeb048cf08
commit
a0edb5975f
13
app/funct.py
13
app/funct.py
|
@ -301,8 +301,11 @@ def check_login(**kwargs):
|
|||
return False
|
||||
|
||||
|
||||
def get_user_id():
|
||||
def get_user_id(**kwargs):
|
||||
import sql
|
||||
if kwargs.get('login'):
|
||||
return sql.get_user_id_by_username(kwargs.get('login'))
|
||||
|
||||
import http.cookies
|
||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||
user_uuid = cookie.get('uuid')
|
||||
|
@ -948,7 +951,8 @@ def upload_and_restart(server_ip, cfg, **kwargs):
|
|||
if haproxy_enterprise == '1':
|
||||
service_name = "hapee-2.0-lb"
|
||||
if service == 'apache':
|
||||
get_correct_apache_service_name(server_ip)
|
||||
service_name = get_correct_apache_service_name(server_ip, 0)
|
||||
|
||||
|
||||
reload_command = " && sudo systemctl reload " + service_name
|
||||
restart_command = " && sudo systemctl restart " + service_name
|
||||
|
@ -1048,7 +1052,7 @@ def upload_and_restart(server_ip, cfg, **kwargs):
|
|||
logging('localhost', str(e), haproxywi=1)
|
||||
|
||||
try:
|
||||
user_id = get_user_id()
|
||||
user_id = get_user_id(login=kwargs.get('login'))
|
||||
sql.insert_config_version(server_id, user_id, service, cfg, config_path, diff)
|
||||
except Exception as e:
|
||||
logging('localhost', str(e), haproxywi=1)
|
||||
|
@ -1958,8 +1962,7 @@ def send_message_to_rabbit(message: str, **kwargs) -> None:
|
|||
rabbit_port,
|
||||
rabbit_vhost,
|
||||
credentials)
|
||||
print(str(parameters))
|
||||
print(str(credentials))
|
||||
|
||||
connection = pika.BlockingConnection(parameters)
|
||||
channel = connection.channel()
|
||||
channel.queue_declare(queue=rabbit_queue)
|
||||
|
|
|
@ -487,6 +487,7 @@ if form.getvalue('action_apache') is not None and serv is not None:
|
|||
|
||||
if form.getvalue('action_service') is not None:
|
||||
action = form.getvalue('action_service')
|
||||
is_in_docker = os.environ.get('IN_DOCKER', False)
|
||||
if action == 'stop':
|
||||
cmd = "sudo systemctl disable %s --now" % serv
|
||||
elif action == "start":
|
||||
|
@ -499,6 +500,8 @@ if form.getvalue('action_service') is not None:
|
|||
if not sql.select_user_status():
|
||||
print('warning: The service is disabled because you are not subscribed. Read <a href="https://roxy-wi.org/pricing.py" title="Roxy-WI pricing" target="_blank">here</a> about subscriptions')
|
||||
sys.exit()
|
||||
if is_in_docker:
|
||||
cmd = "supervisorctl " + action + " " + serv
|
||||
output, stderr = funct.subprocess_execute(cmd)
|
||||
funct.logging('localhost', ' The service ' + serv + ' has been ' + action + 'ed', haproxywi=1, login=1)
|
||||
|
||||
|
|
|
@ -312,25 +312,27 @@
|
|||
{% set admin_uri = 'users.py' %}
|
||||
{% endif %}
|
||||
<table class="overview-wi">
|
||||
<tr class="overviewHead" style="height: 30px;">
|
||||
<td class="padding10 first-collumn-wi">
|
||||
<a href="{{admin_uri}}#users" title="Manage users" class="logs_link">Login</a>
|
||||
</td>
|
||||
<td class="second-collumn">Groups</td>
|
||||
<td>Role</td>
|
||||
<td>
|
||||
<span class="add-button-wi">
|
||||
<span title="Show all users" id="show-all-users" style="color: #fff">
|
||||
Show all
|
||||
<thead>
|
||||
<tr class="overviewHead" style="height: 30px;">
|
||||
<td class="padding10 first-collumn-wi">
|
||||
<a href="{{admin_uri}}#users" title="Manage users" class="logs_link">Login</a>
|
||||
</td>
|
||||
<td class="second-collumn">Groups</td>
|
||||
<td>Role</td>
|
||||
<td>
|
||||
<span class="add-button-wi">
|
||||
<span title="Show all users" id="show-all-users" style="color: #fff">
|
||||
Show all
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</td>
|
||||
<td style="padding-right: 10px;">
|
||||
<a onclick="showUsersOverview()" title="Refresh" style="float: right;">
|
||||
<span class="refresh"></span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
<td style="padding-right: 10px;">
|
||||
<a onclick="showUsersOverview()" title="Refresh" style="float: right;">
|
||||
<span class="refresh"></span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="users-table"></tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
|
|
@ -36,7 +36,9 @@
|
|||
<br />
|
||||
<h3>
|
||||
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
|
||||
or on "<a href="hapservers.py?service=nginx" title="NGINX Overview">NGINX Overview</a>"
|
||||
or on "<a href="hapservers.py?service=apache" title="Apache Overview">Apache Overview</a>"
|
||||
or on "<a href="hapservers.py?service=keepalived" title="Keepalived Overview">Keepalived Overview</a>" pages
|
||||
</h3>
|
||||
<br />
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue