#!/usr/bin/env python3 import html import cgi import os import http.cookies from configparser import ConfigParser, ExtendedInterpolation import funct import sql form = cgi.FieldStorage() serv = form.getvalue('serv') servNew = form.getvalue('serNew') funct.head("Edit HAproxy config") funct.check_config() funct.check_login() funct.page_for_admin(level = 1) path_config = "haproxy-webintarface.config" config = ConfigParser(interpolation=ExtendedInterpolation()) config.read(path_config) log_path = config.get('main', 'log_path') hap_configs_dir = config.get('configs', 'haproxy_save_configs_dir') funct.chooseServer("config.py", "Edit HAproxy config", "y") if serv is not None: cfg = hap_configs_dir + serv + "-" + funct.get_data('config') + ".cfg" if form.getvalue('serv') is not None and form.getvalue('open') is not None : funct.logging(serv, "config.py open config") funct.get_config(serv, cfg) try: conf = open(cfg, "r") except IOError: print('