sql.append("INSERT INTO settings (param, value, section, `desc`) values('syslog_server_enable', '0', 'logs', 'If exist syslog server for HAproxy logs, enable this option');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('log_time_storage', '14', 'logs', 'Time of storage of logs of user activity, in days');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('restart_command', 'systemctl restart haproxy', 'haproxy', 'Command for restart HAproxy service');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('reload_command', 'systemctl reload haproxy', 'haproxy', 'Command for reload HAproxy service');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('status_command', 'systemctl status haproxy', 'haproxy', 'Command for status check HAproxy service');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('stats_user', 'admin', 'haproxy', 'Username for Stats web page HAproxy');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('stats_password', 'password', 'haproxy', 'Password for Stats web page HAproxy');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('stats_port', '8085', 'haproxy', 'Port Stats web page HAproxy');")
sql="""INSERT INTO settings (param, value, section, `desc`) values('reload_command', 'systemctl reload haproxy', 'haproxy', 'Command for reload HAproxy service'); """
try:
cur.execute(sql)
con.commit()
exceptsqltool.Errorase:
ifkwargs.get('silent')!=1:
ife.args[0]=='duplicate column name: param'ore=="1060 (42S21): Duplicate column name 'param'":
print('DB was update to 3.4.9.5')
else:
print("Updating... go to version 3.8.1")
returnFalse
else:
returnTrue
cur.close()
con.close()
defupdate_db_v_3_5_3(**kwargs):
con,cur=get_cur()
sql="""CREATE TABLE IF NOT EXISTS `saved_servers` ( `id` INTEGER NOT NULL, `server` VARCHAR ( 64 ), `description` VARCHAR ( 120 ), `groups` VARCHAR ( 120 ), PRIMARY KEY(`id`)); """
@ -392,9 +370,6 @@ def update_db_v_4(**kwargs):
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_stats_password', 'password', 'nginx', 'Password for Stats web page Nginx');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_stats_port', '8086', 'nginx', 'Stats port for web page Nginx');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_stats_page', 'stats', 'nginx', 'URI Stats for web page Nginx');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_restart_command', 'systemctl restart nginx', 'nginx', 'Command for restart Nginx service');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_reload_command', 'systemctl reload nginx', 'nginx', 'Command for reload Nginx service');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_status_command', 'systemctl status nginx', 'nginx', 'Command for status check Nginx service');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_dir', '/etc/nginx/conf.d/', 'nginx', 'Path to Nginx dir');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_config_path', '/etc/nginx/conf.d/default.conf', 'nginx', 'Path to Nginx config');")