Pavel Loginov 3 years ago
parent 88642761d7
commit d1dde559a3

@ -1229,8 +1229,7 @@ if form.getvalue('master'):
os.system("cp scripts/%s ." % script) os.system("cp scripts/%s ." % script)
commands = ["chmod +x " + script + " && ./" + script + " PROXY=" + proxy_serv + " SSH_PORT=" + ssh_port + commands = ["chmod +x " + script + " && ./" + script + " PROXY=" + proxy_serv + " SSH_PORT=" + ssh_port +
" ETH=" + ETH + " IP=" + str(IP) + " MASTER=MASTER" + " ETH=" + ETH + " IP=" + str(IP) + " MASTER=MASTER" + " SYN_FLOOD=" + syn_flood + " HOST=" + str(master) +
" SYN_FLOOD=" + syn_flood + " HOST=" + str(master) +
" USER=" + str(ssh_user_name) + " PASS='" + str(ssh_user_password) + "' KEY=" + str(ssh_key_name)] " USER=" + str(ssh_user_name) + " PASS='" + str(ssh_user_password) + "' KEY=" + str(ssh_key_name)]
output, error = funct.subprocess_execute(commands[0]) output, error = funct.subprocess_execute(commands[0])
@ -2154,6 +2153,7 @@ if form.getvalue('serverdel') is not None:
sql.delete_waf_rules(server_ip) sql.delete_waf_rules(server_ip)
sql.delete_action_history(server_id) sql.delete_action_history(server_id)
sql.delete_system_info(server_id) sql.delete_system_info(server_id)
sql.delete_service_settings(server_id)
print("Ok") print("Ok")
funct.logging(server_ip, 'The server ' + hostname + ' has been deleted', haproxywi=1, login=1) funct.logging(server_ip, 'The server ' + hostname + ' has been deleted', haproxywi=1, login=1)

@ -2861,6 +2861,14 @@ def select_service_setting(server_id: int, service: str, setting: str) -> str:
return result return result
def delete_service_settings(server_id: int):
query = ServiceSetting.delete().where(ServiceSetting.server_id == server_id)
try:
query.execute()
except Exception as e:
out_error(e)
def insert_action_history(service: str, action: str, server_id: int, user_id: int, user_ip: str): def insert_action_history(service: str, action: str, server_id: int, user_id: int, user_ip: str):
try: try:
ActionHistory.insert(service=service, ActionHistory.insert(service=service,

@ -55,10 +55,10 @@ if serv is not None and form.getvalue('del') is not None:
env = Environment(loader=FileSystemLoader('templates/')) env = Environment(loader=FileSystemLoader('templates/'))
template = env.get_template('delver.html') template = env.get_template('delver.html')
for get in form: for get in form:
if conf_format in get: if conf_format in get and serv in get:
try: try:
if form.getvalue('style') == 'new': if form.getvalue('style') == 'new':
if sql.delete_config_version(form.getvalue('service'), form.getvalue(get)): if sql.delete_config_version(service, form.getvalue(get)):
try: try:
os.remove(form.getvalue(get)) os.remove(form.getvalue(get))
except OSError as e: except OSError as e:
@ -86,7 +86,8 @@ if serv is not None and form.getvalue('config') is not None:
if service == 'keepalived': if service == 'keepalived':
stderr = funct.upload_and_restart(serv, configver, just_save=save, keepalived=1) stderr = funct.upload_and_restart(serv, configver, just_save=save, keepalived=1)
elif service == 'nginx': elif service == 'nginx':
stderr = funct.master_slave_upload_and_restart(serv, configver, just_save=save, nginx=1) config_file_name = sql.select_remote_path_from_version(server_ip=serv, service=service, local_path=configver)
stderr = funct.master_slave_upload_and_restart(serv, configver, just_save=save, nginx=1, config_file_name=config_file_name)
else: else:
stderr = funct.master_slave_upload_and_restart(serv, configver, just_save=save) stderr = funct.master_slave_upload_and_restart(serv, configver, just_save=save)

@ -139,7 +139,7 @@ function ajaxActionServers(action, id) {
toastr.error(data); toastr.error(data);
} else { } else {
if (cur_url[0] == "hapservers.py") { if (cur_url[0] == "hapservers.py") {
location.reload() location.reload();
} else { } else {
setTimeout(showOverview(ip, hostnamea), 2000) setTimeout(showOverview(ip, hostnamea), 2000)
} }
@ -530,6 +530,7 @@ function serverSettingsSave(id, name, service, dialog_id) {
toastr.error(data); toastr.error(data);
} else { } else {
dialog_id.dialog('close'); dialog_id.dialog('close');
location.reload();
} }
} }
}); });

Loading…
Cancel
Save