# -*- coding: utf-8 -*-" import cgi import os, sys import paramiko import http.cookies from paramiko import SSHClient from datetime import datetime from pytz import timezone from configparser import ConfigParser, ExtendedInterpolation path_config = "haproxy-webintarface.config" config = ConfigParser(interpolation=ExtendedInterpolation()) config.read(path_config) form = cgi.FieldStorage() serv = form.getvalue('serv') fullpath = config.get('main', 'fullpath') time_zone = config.get('main', 'time_zone') proxy = config.get('main', 'proxy') ssh_keys = config.get('ssh', 'ssh_keys') ssh_user_name = config.get('ssh', 'ssh_user_name') haproxy_configs_server = config.get('configs', 'haproxy_configs_server') hap_configs_dir = config.get('configs', 'haproxy_save_configs_dir') haproxy_config_path = config.get('haproxy', 'haproxy_config_path') tmp_config_path = config.get('haproxy', 'tmp_config_path') restart_command = config.get('haproxy', 'restart_command') def check_config(): for section in [ 'main', 'configs', 'ssh', 'logs', 'haproxy' ]: if not config.has_section(section): print('