mirror of
https://scm.tikali.ai/tikali/applications/monky/monky-deployd.git
synced 2026-09-18 03:36:16 +00:00
43615a6fda
Three faults from one agent-managed onboarding (env-dev-08, 2026-09-09), each of which pointed the diagnosis away from the actual fault. 1. install.sh granted the agent's read on the ziti identity with a POSIX ACL. ziti-edge-tunnel rewrites that file on a controller config update and the rewrite drops the ACL: the agent applied cleanly at 01:21 and was failing every tick by 01:32. Group membership survives the rewrite (the file stays ziti:ziti 0640), so install.sh and the package postinstall now add monky-deployd to the `ziti` group, and a default ACL on the identity directory carries the grant onto a newly created file. The explicit ACLs stay for the boxes that need them. 2. openziti.load() accepts an unreadable or malformed identity: the C SDK logs "configuration is invalid" and returns a context that only fails at dial, as a bare TypeError, which the transport reported as a missing intercept or a policy gap. The SDK transport now reads and parses the identity itself and names the real fault first. 3. The disk pre-flight ran only when the bundle declared disk_need_bytes, so a bundle without one died mid-pull with containerd's "no space left on device" — which reads as a registry fault. A bundle that declares no size now has to clear the headroom floor, and the pre-flight measures containerd's root as well as the docker data-root: docker 29 keeps image layers in the containerd image store, and on env-dev-08 those sat on different filesystems (93 GiB free where the agent looked, 2.8 GiB where the pull wrote). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KLB7jieMNRkTsJ2epr4Ds1
55 lines
1.7 KiB
Python
55 lines
1.7 KiB
Python
"""The SDK transport names an unusable identity file instead of failing at dial.
|
|
|
|
openziti.load() accepts an unreadable or malformed identity, logs "configuration is invalid"
|
|
at the C layer and returns a context that only fails when something dials through it — as a
|
|
bare TypeError that reads like a missing intercept. env-dev-08 (2026-09-09) lost its identity
|
|
ACL to a tunneller rewrite and spent every tick reporting a mesh fault it did not have.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
|
|
import pytest
|
|
|
|
from monky_deployd.transport import SdkTransport, TransportError
|
|
|
|
|
|
def _sdk(path):
|
|
t = SdkTransport(str(path))
|
|
return t
|
|
|
|
|
|
def test_missing_identity_is_named(tmp_path):
|
|
with pytest.raises(TransportError) as e:
|
|
_sdk(tmp_path / "absent.json")._check_identity_readable()
|
|
assert "does not exist" in str(e.value)
|
|
|
|
|
|
def test_malformed_identity_is_named(tmp_path):
|
|
p = tmp_path / "id.json"
|
|
p.write_text("{not json")
|
|
with pytest.raises(TransportError) as e:
|
|
_sdk(p)._check_identity_readable()
|
|
assert "not valid JSON" in str(e.value)
|
|
|
|
|
|
def test_unreadable_identity_points_at_the_group_grant(tmp_path, monkeypatch):
|
|
p = tmp_path / "id.json"
|
|
p.write_text(json.dumps({"ztAPI": "https://example.invalid"}))
|
|
|
|
def _denied(*a, **k):
|
|
raise PermissionError(13, "Permission denied")
|
|
|
|
monkeypatch.setattr("builtins.open", _denied)
|
|
with pytest.raises(TransportError) as e:
|
|
_sdk(p)._check_identity_readable()
|
|
msg = str(e.value)
|
|
assert "not readable" in msg and "group" in msg
|
|
|
|
|
|
def test_a_good_identity_passes(tmp_path):
|
|
p = tmp_path / "id.json"
|
|
p.write_text(json.dumps({"ztAPI": "https://example.invalid"}))
|
|
_sdk(p)._check_identity_readable() # no raise
|