Skip to content

Commit

Permalink
same for deprovisionning: reload once
Browse files Browse the repository at this point in the history
  • Loading branch information
OniriCorpe committed May 20, 2024
1 parent 832b9d3 commit 6b564ef
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/utils/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -1341,16 +1341,19 @@ def provision_or_update(self, context: Dict = {}):
firewall_reload()

def deprovision(self, context: Dict = {}):
from yunohost.firewall import firewall_disallow
from yunohost.firewall import firewall_disallow, firewall_list, firewall_reload

previous_ports = firewall_list(raw=True)

for name, infos in self.ports.items():
setting_name = f"port_{name}" if name != "main" else "port"
value = self.get_setting(setting_name)
self.delete_setting(setting_name)
if value and str(value).strip():
firewall_disallow(
infos["exposed"], int(value), reload_only_if_change=True
)
firewall_disallow(infos["exposed"], int(value), no_reload=True)

if firewall_list(raw=True) != previous_ports:
firewall_reload()


class DatabaseAppResource(AppResource):
Expand Down

0 comments on commit 6b564ef

Please sign in to comment.