Firewalld suppoty
pull/19/head
Aidaho12 2018-04-27 10:42:20 +06:00
parent 6ef59643dd
commit 97f5781313
2 changed files with 14 additions and 7 deletions

View File

@ -397,10 +397,13 @@ def upload_and_restart(serv, cfg, **kwargs):
commands = [ "/sbin/haproxy -q -c -f " + tmp_file, "mv -f " + tmp_file + " " + haproxy_config_path ] commands = [ "/sbin/haproxy -q -c -f " + tmp_file, "mv -f " + tmp_file + " " + haproxy_config_path ]
else: else:
commands = [ "/sbin/haproxy -q -c -f " + tmp_file, "mv -f " + tmp_file + " " + haproxy_config_path, restart_command ] commands = [ "/sbin/haproxy -q -c -f " + tmp_file, "mv -f " + tmp_file + " " + haproxy_config_path, restart_command ]
if config.get('haproxy', 'firewall_enable') == "1": try:
commands.extend(open_port_firewalld(cfg)) if config.get('haproxy', 'firewall_enable') == "1":
commands.extend(open_port_firewalld(cfg))
except:
print('<div class="alert alert-warning">Please check the config for the presence of the parameter - "firewall_enable". Mast be: "0" or "1". Firewalld configure not working now </div>')
i = 0 i = 0
for command in commands: for command in commands:
i = i + 1 i = i + 1
@ -409,8 +412,7 @@ def upload_and_restart(serv, cfg, **kwargs):
if not stderr.read(): if not stderr.read():
print('<div class="alert alert-success">Config ok</div><pre>') print('<div class="alert alert-success">Config ok</div><pre>')
else: else:
print('<div class="alert alert-danger">In your config have errors, please check, and try again</div>') print('<div class="alert alert-danger">In your config have errors, please check, and try again</div><br><br>')
print(stderr.read().decode(encoding='UTF-8'))
return False return False
break break
if i is not 1: if i is not 1:

View File

@ -530,7 +530,7 @@ a:focus {
padding-left: 10px; padding-left: 10px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.alert-danger, .alert-info, .alert-success { .alert-danger, .alert-info, .alert-success, .alert-warning {
width: 400px; width: 400px;
margin-left: 15px; margin-left: 15px;
} }
@ -554,6 +554,11 @@ a:focus {
background-color: #d1ecf1; background-color: #d1ecf1;
border-color: #bee5eb; border-color: #bee5eb;
} }
.alert-warning {
color: #856404;
background-color: #fff3cd;
border-color: #ffeeba;
}
label { label {
display: inline-block; display: inline-block;
max-width: 100%; max-width: 100%;