diff --git a/app/funct.py b/app/funct.py index ddc70c50..5cf77869 100644 --- a/app/funct.py +++ b/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) diff --git a/app/options.py b/app/options.py index 1e144e93..9a619101 100644 --- a/app/options.py +++ b/app/options.py @@ -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 here 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) diff --git a/app/templates/ovw.html b/app/templates/ovw.html index 2687f4f1..f3ac19ab 100644 --- a/app/templates/ovw.html +++ b/app/templates/ovw.html @@ -312,25 +312,27 @@ {% set admin_uri = 'users.py' %} {% endif %} - - - - - + + + + + - - + + + +
- Login - GroupsRole - - - Show all +
+ Login + GroupsRole + + + Show all + - - - - - -
+ + + +
{% endif %} diff --git a/app/templates/smon.html b/app/templates/smon.html index 0f7bbd31..25d444b0 100644 --- a/app/templates/smon.html +++ b/app/templates/smon.html @@ -36,7 +36,9 @@

No events added yet. Check if there are any Checker are enabled on the "HAProxy Overview" - or on "Nginx Overview" pages + or on "NGINX Overview" + or on "Apache Overview" + or on "Keepalived Overview" pages