From a90b40ece05bf05a53528f03694cd4d2c0ed0047 Mon Sep 17 00:00:00 2001 From: Pavel Loginov Date: Tue, 10 Mar 2020 19:25:59 +0100 Subject: [PATCH] v4.0.0.0 Changelog: https://haproxy-wi.org/changelog.py#4 --- app/funct.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/funct.py b/app/funct.py index 3a7adb32..5196e1f5 100644 --- a/app/funct.py +++ b/app/funct.py @@ -596,7 +596,7 @@ def upload_and_restart(serv, cfg, **kwargs): else: commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + config_path + " && sudo systemctl restart haproxy" ] if sql.get_setting('firewall_enable') == "1": - commands.extend(open_port_firewalld(cfg)) + commands[0] += open_port_firewalld(cfg) error += str(upload(serv, tmp_file, cfg, dir='fullpath')) try: @@ -628,7 +628,8 @@ def open_port_firewalld(cfg): except IOError: print('
Can\'t read export config file
') - firewalld_commands = [] + firewalld_commands = ' &&' + ports = '' for line in conf: if "bind" in line: @@ -636,9 +637,11 @@ def open_port_firewalld(cfg): bind[1] = bind[1].strip(' ') bind = bind[1].split("ssl") bind = bind[0].strip(' \t\n\r') - firewalld_commands.append('sudo firewall-cmd --zone=public --add-port=%s/tcp --permanent' % bind) + firewalld_commands += ' sudo firewall-cmd --zone=public --add-port=%s/tcp --permanent -q &&' % bind + ports += bind+' ' - firewalld_commands.append('sudo firewall-cmd --reload') + firewalld_commands += 'sudo firewall-cmd --reload -q' + logging('localhost', ' Next ports have opened: '+ports+ ' has opened ') return firewalld_commands