YunoHost / issues

General issue tracker for the YunoHost project
71 stars 7 forks source link

App install fails with "Failed to provision ports : argument of type 'NoneType' is not iterable" #2362

Open milouse opened 3 months ago

milouse commented 3 months ago

Describe the bug

This is a bug I encountered now several time, with different applications (that’s why I’m not pushing it to any specific app repository). It first block me to install ethercalc, and now umami. Each time it’s the same thing, the installation of the app fails very quickly at the beginining of the process, with the following logs: https://paste.yunohost.org/raw/utoboqoqup

Context

To reproduce

sudo yunohost app install umami

Expected behavior

The app install without problems.

Logs

https://paste.yunohost.org/raw/utoboqoqup

I’m not sure how to make logs more verbose, don’t hesitate to give me hints. I’m willing to help as much as I can.

At first I though it was only related to ethercalc only, but now that it fails also with umami, it seems to be a more generic issue. Now I wonder if the problem could comes from the fact these apps have to be installed on their own domain (instead of subpath?) But what is weird is that I successfully installed nextcloud on its own subdomain in the mean time (but it’s a PHP app, which does not require custom ports maybe?)

milouse commented 3 months ago

Ok, after some digging, I’ve found the origin of the error.

In the function firewall_disallow, this check is failing because my current firewall retrieved configuration is like this:

{
    'ipv4': {
        'TCP': [<redacted>],
        'UDP': [<redacted>]
    },
    'ipv6': {
        'TCP': [<redacted>],
        'UDP': [<redacted>]
    },
    'uPnP': {
        'TCP': [<redacted>],
        'TCP_TO_CLOSE': [<redacted>],
        'UDP': None,
        'enabled': False
    }
}

The interesting part is the UDP value in uPnP, which is "None" instead of an empty list I guess. This is because there is no UDP property for uPnP in the yaml file.

I made it works by replacing the previously named check by:

if upnp and isinstance(firewall["uPnP"][p], list) and port in firewall["uPnP"][p]:

Does it worths an MR or did I misunderstood something?