learningequality / kolibri

Kolibri Learning Platform: the offline app for universal education
https://learningequality.org/kolibri/
MIT License
815 stars 691 forks source link

When importing from local network(self hosted studio), devices are unavailabe until some another device with same IP is created #12750

Open thesujai opened 1 month ago

thesujai commented 1 month ago

Observed behavior

Devices with same IP are shown unavailable Image Now I add another device with same IP, it is availabe Image

Now if I refresh again after some time(don't know how much time), then the newly available device is also somehow unavailable, even when the studio is running locally

Errors and logs

When the SelectDeviceForm component renders, a request is made to update_connection_status/ which will give a 500:

[python-devserver] ERROR    2024-10-25 16:01:18,989 Internal Server Error: /api/discovery/networklocation/62143eb22ca04e618af313010afe9d92/update_connection_status/
[python-devserver] Traceback (most recent call last):
[python-devserver]   File "/home/sujai/.pyenv/versions/3.9.9/envs/kolibriNew/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
[python-devserver]     return self.cursor.execute(sql, params)
[python-devserver]   File "/home/sujai/.pyenv/versions/3.9.9/envs/kolibriNew/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute
[python-devserver]     return Database.Cursor.execute(self, query, params)
[python-devserver] sqlite3.IntegrityError: NOT NULL constraint failed: discovery_networklocation.operating_system

operation_system response field from studio's api/public/info should not be None as it is now(code).

  1. It can be empty or can at least attempt to get the os using some tools in studio itself
  2. Else this has to be handled in kolibri, which is better as it is the responsibility of this server to handle the any foreign data

I think both kolibri and studio be updated with changes

Expected behavior

If the studio is running, the devices should be available

User-facing consequences

No idea, but I faced while working on an issue, everytime I updated the studio channel, I added another device in kolibri

Steps to reproduce

  1. Make sure a Kolibri and a studio instance is running
  2. Go to Devices>Channels>Import>Local Netwok
  3. Add a device with default IP of studio 0.0.0.0:8080(It will work)
  4. After some time refresh it and it will become unavailable
  5. Add another device, it will work, but after some time this will also become unavailable too

    Context

    • Kolibri version: 0.17.2
    • Operating system: Ubuntu 22 LTS
    • Browser: Firefox and Chromium