Skip to content

Reserved network locations for Studio and KDP #10431

@bjester

Description

@bjester

Summary

As a developer, in support of remote content browsing and pursuit of leveraging existing functionality, I would like to use the NetworkLocation models and associated architecture to interact with Studio and KDP. We can also leverage functionality added with the is_local attribute to generalize interacting with devices on the internet.

Note: KDP doesn't currently respond to the info endpoint, so we should prevent requests to KDP until we update KDP.

Deliverables

The task helper _enqueue_network_location_update_with_backoff

  • It should prevent enqueuing new tasks when is_local is False

The model NetworkLocation

  • A new type field should be added with choices of static, dynamic, and reserved
  • A django migration should migrate all models with dynamic = False to have type of static (all dynamic = True can be deleted)
  • The field dynamic should be removed from the model once type has been set
  • The type field should be NOT NULL once migrated
  • The existing DynamicNetworkLocation and StaticNetworkLocation models should be migrated to use the new type field

The task reset_connection_states

  • It should update or create reserved network locations for Studio and KDP, using the URLs defined in Kolibri's options.ini
  • The reserved network locations should use hardcoded IDs
  • The connection state for the locations should be reset like static locations
  • It should not enqueue a perform_network_location_update task for KDP, but should set its application to Kolibri Data Portal

The viewsets for NetworkLocations

  • It should annotate a dynamic attribute on the response which is true when type is dynamic
  • Only static models should be allowed to be created and it should set the type to static when creating them
  • It should have a new syncable filter, which should include KDP's reserved location when 1 and Studio when 0
  • If syncable filter is not provided, always exclude both KDP and Studio
  • Its method update_connection_status should prevent making requests to KDP's location for the time being

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions