mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Remove port from firewall.yml
This commit is contained in:
parent
add6a388f4
commit
daaddf238f
1 changed files with 7 additions and 4 deletions
|
@ -136,12 +136,15 @@ def append_remove_port(port=None,protocol=None,mode=None,ip=None):
|
|||
'''
|
||||
with open('firewall.yml','r') as f:
|
||||
firewall = yaml.load(f)
|
||||
if port not in firewall[ip][protocol]:
|
||||
if mode == 'a':
|
||||
|
||||
if mode == 'a':
|
||||
if port not in firewall[ip][protocol]:
|
||||
firewall[ip][protocol].append(int(port))
|
||||
else:
|
||||
else:
|
||||
if port not in firewall[ip][protocol]:
|
||||
firewall[ip][protocol].remove(int(port))
|
||||
firewall[ip][protocol].sort()
|
||||
|
||||
firewall[ip][protocol].sort()
|
||||
f.close
|
||||
|
||||
os.system("mv firewall.yml firewall.yml.old")
|
||||
|
|
Loading…
Reference in a new issue