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 ]
else:
commands = [ "/sbin/haproxy -q -c -f " + tmp_file, "mv -f " + tmp_file + " " + haproxy_config_path, restart_command ]
if config.get('haproxy', 'firewall_enable') == "1":
commands.extend(open_port_firewalld(cfg))
try:
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
for command in commands:
i = i + 1
@ -409,8 +412,7 @@ def upload_and_restart(serv, cfg, **kwargs):
if not stderr.read():
print('<div class="alert alert-success">Config ok</div><pre>')
else:
print('<div class="alert alert-danger">In your config have errors, please check, and try again</div>')
print(stderr.read().decode(encoding='UTF-8'))
print('<div class="alert alert-danger">In your config have errors, please check, and try again</div><br><br>')
return False
break
if i is not 1:

View File

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