diff --git a/docs/deploy.md b/docs/deploy.md index 4f38718..9d2d776 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -177,9 +177,9 @@ runs on the drukbox machine. It does not support Tailscale. Prepare the host fully before drukbox starts. drukbox only connects to the host: -1. Install Docker Engine and `docker-sbx`. Ubuntu 24.04+ with KVM is - necessary: `/dev/kvm` must exist, and the service user must be in the - `kvm` group. +1. Install Docker Engine and `docker-sbx` 0.48.0 or later. Ubuntu 24.04+ + with KVM is necessary: `/dev/kvm` must exist, and the service user + must be in the `kvm` group. 2. Sign in one time with `sbx login`. Headless hosts use a device-code flow. 3. Start the daemon: `sbx daemon start -d --policy balanced`. diff --git a/src/providers/docker_sbx/api.py b/src/providers/docker_sbx/api.py index 4ca5861..07fda42 100644 --- a/src/providers/docker_sbx/api.py +++ b/src/providers/docker_sbx/api.py @@ -37,7 +37,6 @@ async def create_sandbox( str(cpus), "--memory", memory, - "--quiet", "shell", workspace, ) @@ -129,10 +128,9 @@ async def remove_template(self, template: str) -> None: async def sandbox_count(self) -> int: output = await self._run("ls", "--json") try: - payload = json.loads(output) # Go writes an empty list as null. - return len(payload["sandboxes"] or []) - except (json.JSONDecodeError, KeyError, TypeError) as error: + return len(json.loads(output) or []) + except json.JSONDecodeError as error: raise DockerSbxTransportError( f"sbx ls returned an unreadable sandbox list: {output.strip()!r}" ) from error diff --git a/src/providers/docker_sbx/tests/test_api.py b/src/providers/docker_sbx/tests/test_api.py index 36f96b0..f0111a7 100644 --- a/src/providers/docker_sbx/tests/test_api.py +++ b/src/providers/docker_sbx/tests/test_api.py @@ -168,7 +168,7 @@ async def fake_exec(*args, **kwargs): @pytest.mark.asyncio async def test_sandbox_count_reads_the_listing(monkeypatch): - listing = b'{"sandboxes": [{"name": "sb-a"}, {"name": "sb-b"}]}' + listing = b'[{"name": "sb-a"}, {"name": "sb-b"}]' create = AsyncMock(return_value=_process(stdout=listing)) monkeypatch.setattr("providers.docker_sbx.api.asyncio.create_subprocess_exec", create) @@ -178,7 +178,7 @@ async def test_sandbox_count_reads_the_listing(monkeypatch): @pytest.mark.asyncio async def test_sandbox_count_treats_a_null_list_as_empty(monkeypatch): # Go writes an empty list as null. An unused daemon shows null. - create = AsyncMock(return_value=_process(stdout=b'{"sandboxes": null}')) + create = AsyncMock(return_value=_process(stdout=b"null")) monkeypatch.setattr("providers.docker_sbx.api.asyncio.create_subprocess_exec", create) assert await SbxCLI().sandbox_count() == 0