2018-04-30 06:04:21 +00:00
|
|
|
#!/usr/bin/env python3
|
2019-06-30 09:21:52 +00:00
|
|
|
import http.cookies
|
2018-04-30 06:04:21 +00:00
|
|
|
import cgi
|
2018-05-05 12:40:41 +00:00
|
|
|
import os
|
|
|
|
import funct, sql
|
|
|
|
from jinja2 import Environment, FileSystemLoader
|
|
|
|
env = Environment(loader=FileSystemLoader('templates/'))
|
|
|
|
template = env.get_template('ihap.html')
|
2018-05-17 08:13:54 +00:00
|
|
|
|
2018-05-05 12:40:41 +00:00
|
|
|
print('Content-type: text/html\n')
|
2018-04-30 06:04:21 +00:00
|
|
|
funct.check_login()
|
2018-06-28 05:55:07 +00:00
|
|
|
funct.page_for_admin(level = 2)
|
2018-05-05 12:40:41 +00:00
|
|
|
|
|
|
|
try:
|
|
|
|
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
|
|
|
user_id = cookie.get('uuid')
|
|
|
|
user = sql.get_user_name_by_uuid(user_id.value)
|
|
|
|
servers = sql.get_dick_permit()
|
2018-06-01 12:27:58 +00:00
|
|
|
token = sql.get_token(user_id.value)
|
2018-05-05 12:40:41 +00:00
|
|
|
except:
|
|
|
|
pass
|
2018-04-30 06:04:21 +00:00
|
|
|
|
2018-05-05 12:40:41 +00:00
|
|
|
output_from_parsed_template = template.render(h2 = 1, title = "Installation HAProxy",
|
|
|
|
role = sql.get_user_role_by_uuid(user_id.value),
|
|
|
|
user = user,
|
|
|
|
select_id = "haproxyaddserv",
|
2018-06-01 12:27:58 +00:00
|
|
|
selects = servers,
|
|
|
|
token = token)
|
2018-05-05 12:40:41 +00:00
|
|
|
print(output_from_parsed_template)
|
2018-04-30 06:04:21 +00:00
|
|
|
|