Merge pull request #1622 from YunoHost/fix-_port_is_used

trying to fix _port_is_used
This commit is contained in:
Alexandre Aubin 2023-03-02 18:48:37 +01:00 committed by GitHub
commit 9f211d39f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -916,8 +916,8 @@ class PortsResource(AppResource):
% port
)
# This second command is mean to cover (most) case where an app is using a port yet ain't currently using it for some reason (typically service ain't up)
cmd2 = f"grep --quiet \"port: '{port}'\" /etc/yunohost/apps/*/settings.yml"
return os.system(cmd1) == 0 and os.system(cmd2) == 0
cmd2 = f"grep --quiet --extended-regexp \"port: '?{port}'?\" /etc/yunohost/apps/*/settings.yml"
return os.system(cmd1) == 0 or os.system(cmd2) == 0
def provision_or_update(self, context: Dict = {}):
from yunohost.firewall import firewall_allow, firewall_disallow