mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Do not fail if protocol is not specified
This commit is contained in:
parent
cddae8b54a
commit
cdc777671d
1 changed files with 13 additions and 7 deletions
14
firewall.py
14
firewall.py
|
@ -70,8 +70,11 @@ def firewall_allow(port=None, protocol=['TCP'], ipv6=False, no_upnp=False):
|
|||
"""
|
||||
port = int(port)
|
||||
ipv = "ipv4"
|
||||
protocols = protocol
|
||||
protocol = protocol[0]
|
||||
if isinstance(protocol, list):
|
||||
protocols = protocol
|
||||
else:
|
||||
protocols = [protocol]
|
||||
protocol = protocols[0]
|
||||
|
||||
firewall = firewall_list(raw=True)
|
||||
|
||||
|
@ -109,8 +112,11 @@ def firewall_disallow(port=None, protocol=['TCP'], ipv6=False):
|
|||
"""
|
||||
port = int(port)
|
||||
ipv = "ipv4"
|
||||
protocols = protocol
|
||||
protocol = protocol[0]
|
||||
if isinstance(protocol, list):
|
||||
protocols = protocol
|
||||
else:
|
||||
protocols = [protocol]
|
||||
protocol = protocols[0]
|
||||
|
||||
firewall = firewall_list(raw=True)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue