diff --git a/.github/workflows/no_zombies.yml b/.github/workflows/no_zombies.yml index 83f8a560dfd..b0d9a5379cc 100644 --- a/.github/workflows/no_zombies.yml +++ b/.github/workflows/no_zombies.yml @@ -42,5 +42,5 @@ jobs: pip install . # ensure kolibri stops within 20 seconds 10 times in a row - ./test/ensure_kolibri_stops_within_time.sh 20 10 8082 + ./test/ensure_kolibri_stops_within_time.sh 20 10 8082 8083 ./test/ensure_no_kolibris_running_on_port.sh 8082 diff --git a/kolibri/core/content/utils/paths.py b/kolibri/core/content/utils/paths.py index 794fdf8f28c..bfab772eeee 100644 --- a/kolibri/core/content/utils/paths.py +++ b/kolibri/core/content/utils/paths.py @@ -8,6 +8,7 @@ from kolibri.core.content.errors import InvalidStorageFilenameError from kolibri.utils import conf +from kolibri.utils.server import get_zip_port # valid storage filenames consist of 32-char hex plus a file extension @@ -253,6 +254,20 @@ def get_file_checksums_url(channel_id, baseurl, version="1"): ZIPCONTENT = "zipcontent/" +def get_zip_content_config(): + zip_content_origin = conf.OPTIONS["Deployment"]["ZIP_CONTENT_ORIGIN"] + if not zip_content_origin: + zip_content_port = str( + get_zip_port() or conf.OPTIONS["Deployment"]["ZIP_CONTENT_PORT"] + ) + elif type(zip_content_origin) is int: + zip_content_port = str(zip_content_origin) + zip_content_origin = "" + else: + zip_content_port = "" + return zip_content_origin, zip_content_port + + def zip_content_path_prefix(): path_prefix = conf.OPTIONS["Deployment"]["ZIP_CONTENT_URL_PATH_PREFIX"] diff --git a/kolibri/core/kolibri_plugin.py b/kolibri/core/kolibri_plugin.py index 8786fd5ba0e..bb8080df1f3 100644 --- a/kolibri/core/kolibri_plugin.py +++ b/kolibri/core/kolibri_plugin.py @@ -19,6 +19,7 @@ from kolibri.core.content.utils.paths import get_content_storage_url from kolibri.core.content.utils.paths import get_hashi_path from kolibri.core.content.utils.paths import get_zip_content_base_path +from kolibri.core.content.utils.paths import get_zip_content_config from kolibri.core.device.models import ContentCacheKey from kolibri.core.device.utils import allow_other_browsers_to_connect from kolibri.core.hooks import NavigationHook @@ -53,14 +54,7 @@ def url_tag(self): # For some reason the js_name gets escaped going into the template # so this was the easiest way to inject it. ).replace("__placeholder__", js_name) - zip_content_origin = OPTIONS["Deployment"]["ZIP_CONTENT_ORIGIN"] - if not zip_content_origin: - zip_content_port = str(OPTIONS["Deployment"]["ZIP_CONTENT_PORT"]) - elif type(zip_content_origin) is int: - zip_content_port = str(zip_content_origin) - zip_content_origin = "" - else: - zip_content_port = "" + zip_content_origin, zip_content_port = get_zip_content_config() return [ mark_safe( """