Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] USE_OPENWISP_TOPOLOGY not taken into account in load_init_data script #421

Closed
keviiin38 opened this issue Dec 23, 2024 · 0 comments · Fixed by #422
Closed

[bug] USE_OPENWISP_TOPOLOGY not taken into account in load_init_data script #421

keviiin38 opened this issue Dec 23, 2024 · 0 comments · Fixed by #422
Labels
bug Something isn't working

Comments

@keviiin38
Copy link
Contributor

Describe the bug
When using the Docker Compose setup with the USE_OPENWISP_TOPOLOGY set to False the dashboard service won't start due to an error.

docker-openwisp-dashboard-1  | Running migrations:
docker-openwisp-dashboard-1  |   No migrations to apply.
docker-openwisp-dashboard-1  | Traceback (most recent call last):
docker-openwisp-dashboard-1  |   File "/opt/openwisp/load_init_data.py", line 258, in <module>
docker-openwisp-dashboard-1  |     Topology = load_model('topology', 'Topology')
docker-openwisp-dashboard-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
docker-openwisp-dashboard-1  |   File "/usr/local/lib/python3.12/site-packages/swapper/__init__.py", line 79, in load_model
docker-openwisp-dashboard-1  |     raise ImproperlyConfigured(
docker-openwisp-dashboard-1  | django.core.exceptions.ImproperlyConfigured: Could not find topology.Topology!
docker-openwisp-dashboard-1 exited with code 0

Steps To Reproduce
Steps to reproduce the behavior:

  1. Clone the https://github.com/openwisp/docker-openwisp repository
  2. Edit the .env file and replace USE_OPENWISP_TOPOLOGY=True with USE_OPENWISP_TOPOLOGY=False
  3. Start the Docker Compose stack using docker compose up -d
  4. See the error in the logs of the dashboard service using docker compose logs -f dashboard

Expected behavior
The dashboard service should not fail, and the script load_init_data.py should not exit when the variable USE_OPENWISP_TOPOLOGY is set to False

The script should check the variable value differently here : https://github.com/openwisp/docker-openwisp/blob/master/images/openwisp_dashboard/load_init_data.py#L258

-   if os.environ.get('USE_OPENWISP_TOPOLOGY', False):
+   if os.environ.get('USE_OPENWISP_TOPOLOGY', False) == "True":
        Topology = load_model('topology', 'Topology')
        create_default_topology(default_vpn)

Screenshots
n/a

System Informatioon:

  • OS: Ubuntu 22.04 LTS
  • Docker version: Docker version 24.0.7, build 311b9ff
@keviiin38 keviiin38 added the bug Something isn't working label Dec 23, 2024
keviiin38 added a commit to keviiin38/docker-openwisp that referenced this issue Dec 23, 2024
Fix if condition checking if the default topology should be created.

Fixes openwisp#421
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant