cocoonstack-sandbox 0.1.24__tar.gz → 0.1.25__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/PKG-INFO +1 -1
  2. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonsandbox/client.py +10 -11
  3. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonsandbox/conn.py +5 -5
  4. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonsandbox/sandbox.py +1 -1
  5. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonstack_sandbox.egg-info/PKG-INFO +1 -1
  6. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/pyproject.toml +1 -1
  7. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/LICENSE +0 -0
  8. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/README.md +0 -0
  9. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonsandbox/__init__.py +0 -0
  10. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonsandbox/checkpoint.py +0 -0
  11. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonsandbox/endpoint.py +0 -0
  12. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonsandbox/errors.py +0 -0
  13. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonsandbox/frames.py +0 -0
  14. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonsandbox/py.typed +0 -0
  15. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonsandbox/template.py +0 -0
  16. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonsandbox/volumes.py +0 -0
  17. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonstack_sandbox.egg-info/SOURCES.txt +0 -0
  18. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonstack_sandbox.egg-info/dependency_links.txt +0 -0
  19. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/cocoonstack_sandbox.egg-info/top_level.txt +0 -0
  20. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/setup.cfg +0 -0
  21. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_checkpoint.py +0 -0
  22. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_client.py +0 -0
  23. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_endpoint.py +0 -0
  24. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_fault_matrix.py +0 -0
  25. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_fixtures.py +0 -0
  26. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_frames.py +0 -0
  27. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_hardening.py +0 -0
  28. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_keepalive.py +0 -0
  29. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_packaging.py +0 -0
  30. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_proc.py +0 -0
  31. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_proxy.py +0 -0
  32. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_stream.py +0 -0
  33. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_upgrade.py +0 -0
  34. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_volume_controller.py +0 -0
  35. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_volumes.py +0 -0
  36. {cocoonstack_sandbox-0.1.24 → cocoonstack_sandbox-0.1.25}/tests/test_wire_binding.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cocoonstack-sandbox
3
- Version: 0.1.24
3
+ Version: 0.1.25
4
4
  Summary: Python SDK for the cocoon sandbox control plane
5
5
  License: Apache-2.0
6
6
  Requires-Python: >=3.10
@@ -96,11 +96,12 @@ class Client(_Closeable):
96
96
  )
97
97
  return Sandbox(client=self, id=id, token=token, owner=reply.get("owner_addr") or addr)
98
98
 
99
- addrs = [self.addr, *self._peers()]
99
+ peers, peers_err = self._peers()
100
100
  try:
101
- return _scatter(addrs, probe)
101
+ return _scatter([self.addr, *peers], probe)
102
102
  except APIError:
103
- raise APIError("lookup", 404, f"no owner found for {id}") from None
103
+ reason = f"no owner found for {id}" if peers_err is None else f"no owner found for {id}; {peers_err}"
104
+ raise APIError("lookup", 404, reason) from None
104
105
 
105
106
  def attach(self, owner_addr: str, id: str, token: str) -> Sandbox:
106
107
  """Binds a handle to a known owner without a lookup."""
@@ -176,16 +177,14 @@ class Client(_Closeable):
176
177
  owner, reply = _redirect_fallback(addr, redirect, post, verb)
177
178
  return self._handle_from(owner, reply, verb)
178
179
 
179
- def _peers(self) -> list[str]:
180
+ def _peers(self) -> tuple[list[str], APIError | None]:
180
181
  try:
181
- return (
182
- self._request(
183
- self.addr, "GET", "/v1/peers", None, "peers", timeout=min(_PEERS_TIMEOUT, self.timeout)
184
- ).get("peers")
185
- or []
182
+ reply = self._request(
183
+ self.addr, "GET", "/v1/peers", None, "peers", timeout=min(_PEERS_TIMEOUT, self.timeout)
186
184
  )
187
- except APIError:
188
- return []
185
+ except APIError as exc:
186
+ return [], exc
187
+ return reply.get("peers") or [], None
189
188
 
190
189
  def _handle_from(self, dialed: str, reply: dict[str, Any], verb: str = "claim") -> Sandbox:
191
190
  return Sandbox(
@@ -203,11 +203,6 @@ def dial_agent(
203
203
  except OSError as exc:
204
204
  err = _handshake_error(f"dial {addr}", exc)
205
205
  raise (_mark_gone(err, tag) if isinstance(exc, ConnectionRefusedError) else err) from exc
206
- sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
207
- sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
208
- for opt, setting in _TCP_KEEPALIVE.items():
209
- if hasattr(socket, opt):
210
- sock.setsockopt(socket.IPPROTO_TCP, getattr(socket, opt), setting)
211
206
  request = (
212
207
  f"GET /v1/sandboxes/{sandbox_id}/agent HTTP/1.1\r\n"
213
208
  f"Host: {endpoint.netloc}\r\n"
@@ -218,6 +213,11 @@ def dial_agent(
218
213
  ).encode()
219
214
  reader = None
220
215
  try:
216
+ sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
217
+ sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
218
+ for opt, setting in _TCP_KEEPALIVE.items():
219
+ if hasattr(socket, opt):
220
+ sock.setsockopt(socket.IPPROTO_TCP, getattr(socket, opt), setting)
221
221
  if endpoint.scheme != "https":
222
222
  sock.settimeout(None)
223
223
  return Conn(sock, _buffered_reader(sock), request, timeout, tag)
@@ -306,7 +306,7 @@ class Sandbox:
306
306
  return [f for f in conn.recv_until("done") if f["type"] == "replaced"]
307
307
 
308
308
  def git_clone(self, url: str, path: str, branch: str = "", depth: int = 0, auth: str = "") -> None:
309
- """Clones into path (egress lane only; the none lane answers a typed unimplemented error pointing at push)."""
309
+ """Clones into path, shallow when depth is set; auth rides an in-memory header."""
310
310
  self._done_rpc("git_clone", url=url, path=path, branch=branch or None, depth=depth or None, auth=auth or None)
311
311
 
312
312
  def git_status(self, path: str) -> dict[str, Any]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cocoonstack-sandbox
3
- Version: 0.1.24
3
+ Version: 0.1.25
4
4
  Summary: Python SDK for the cocoon sandbox control plane
5
5
  License: Apache-2.0
6
6
  Requires-Python: >=3.10
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cocoonstack-sandbox"
7
- version = "0.1.24"
7
+ version = "0.1.25"
8
8
  description = "Python SDK for the cocoon sandbox control plane"
9
9
  requires-python = ">=3.10"
10
10
  license = { text = "Apache-2.0" }