Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openwrt/asu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Spooren <mail@aparcar.org>2022-07-30 15:09:09 +0300
committerPaul Spooren <mail@aparcar.org>2022-07-30 15:09:09 +0300
commit22871368d211417a417375d1c7bf3dc491aaa3cc (patch)
treed3562de058d225f9fe2e0c0a64843336093c3189
parent0ca7466e823f1349f26b322b9bb5b2d757147c81 (diff)
api: allow empty filesystem stringv0.7.12
Clients may send an empty filesystem string, don't ignore their requests but handle them as if no filesystem was set. Signed-off-by: Paul Spooren <mail@aparcar.org>
-rw-r--r--asu/build.py3
-rw-r--r--asu/openapi.yml1
-rw-r--r--tests/test_api.py20
3 files changed, 23 insertions, 1 deletions
diff --git a/asu/build.py b/asu/build.py
index 3c80ebd..6fdd044 100644
--- a/asu/build.py
+++ b/asu/build.py
@@ -271,7 +271,7 @@ def build(req: dict):
log.debug("Created store path: %s", req["store_path"] / bin_dir)
- if "filesystem" in req:
+ if req.get("filesystem"):
config_path = cache_workdir / ".config"
config = config_path.read_text()
@@ -293,6 +293,7 @@ def build(req: dict):
config_path.write_text(config)
else:
+ log.debug("Enable default filesystems")
copyfile(
cache_workdir / ".config.orig",
cache_workdir / ".config",
diff --git a/asu/openapi.yml b/asu/openapi.yml
index 283a5be..2d8af63 100644
--- a/asu/openapi.yml
+++ b/asu/openapi.yml
@@ -260,6 +260,7 @@ components:
- ext4
- ubifs
- jffs2
+ - ""
description: |
Ability to specify filesystem running on device. Attaching this
optional parameter will limit the ImageBuilder to only build
diff --git a/tests/test_api.py b/tests/test_api.py
index c236bf5..57ed2ee 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -62,6 +62,26 @@ def test_api_build_filesystem_squashfs(app, upstream):
assert "# CONFIG_TARGET_ROOTFS_EXT4FS is not set" in config
assert "CONFIG_TARGET_ROOTFS_SQUASHFS=y" in config
+def test_api_build_filesystem_empty(app, upstream):
+ client = app.test_client()
+ response = client.post(
+ "/api/v1/build",
+ json=dict(
+ version="TESTVERSION",
+ target="testtarget/testsubtarget",
+ profile="testprofile",
+ packages=["test1", "test2"],
+ filesystem="",
+ ),
+ )
+ assert response.status == "200 OK"
+ assert response.json.get("request_hash") == "33377fbd91c50c4236343f1dfd67f9ae"
+ config = (
+ app.config["CACHE_PATH"] / "cache/TESTVERSION/testtarget/testsubtarget/.config"
+ ).read_text()
+ assert "CONFIG_TARGET_ROOTFS_EXT4FS=y" in config
+ assert "CONFIG_TARGET_ROOTFS_SQUASHFS=y" in config
+
def test_api_build_filesystem_reset(app, upstream):
client = app.test_client()