Skip to content

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

@keviiin38

Description

@keviiin38

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions