openwisp / ansible-wireguard-openwisp

BSD 3-Clause "New" or "Revised" License
6 stars 6 forks source link

ImportError: cannot import name 'url_quote' from 'werkzeug.urls' #41

Open Roomba5 opened 7 months ago

Roomba5 commented 7 months ago

Issue with getting peers added to the wireguard server config

When adding new devices through Openwisp the configs get pushed to the devices properly; however the wireguard server does not get updated with the new peers.

When trying to run the python updater script from the venv directly I am seeing the following errors. These are also populating in the logs file (I'm guessing when the cron runs?).

File "/etc/wireguard-openwisp/env/lib/python3.10/site-packages/flask/__init__.py", line 7, in <module>
    from .app import Flask as Flask
  File "/etc/wireguard-openwisp/env/lib/python3.10/site-packages/flask/app.py", line 28, in <module>
    from . import cli
  File "/etc/wireguard-openwisp/env/lib/python3.10/site-packages/flask/cli.py", line 18, in <module>
    from .helpers import get_debug_flag
  File "/etc/wireguard-openwisp/env/lib/python3.10/site-packages/flask/helpers.py", line 16, in <module>
    from werkzeug.urls import url_quote
ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/etc/wireguard-openwisp/env/lib/python3.10/site-packages/werkzeug/urls.py)
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 72, in apport_excepthook

Potential Solution

It looks like the python dependency werkzeug from version 3.0 onwards removed some depreciated commands that are being called for the Flask portion of this project. Pinning werkzeug<3.0 should fix the issue.

nemesifier commented 1 month ago

This was done: https://github.com/openwisp/ansible-wireguard-openwisp/commit/89cc92f4d3eb68a35fbd303ae9753655957253ca. But we should upgrade the code to the latest version of werkzeug and update the dependency.