address link2xt comments (zone parsing and turn v0.4 release

This commit is contained in:
holger krekel
2026-03-07 07:25:14 +01:00
parent 1a578ecc66
commit ea7b875eb1
6 changed files with 32 additions and 22 deletions

View File

@@ -343,12 +343,12 @@ class TurnDeployer(Deployer):
def install(self): def install(self):
(url, sha256sum) = { (url, sha256sum) = {
"x86_64": ( "x86_64": (
"https://github.com/chatmail/chatmail-turn/releases/download/v0.3/chatmail-turn-x86_64-linux", "https://github.com/chatmail/chatmail-turn/releases/download/v0.4/chatmail-turn-x86_64-linux",
"841e527c15fdc2940b0469e206188ea8f0af48533be12ecb8098520f813d41e4", "1ec1f5c50122165e858a5a91bcba9037a28aa8cb8b64b8db570aa457c6141a8a",
), ),
"aarch64": ( "aarch64": (
"https://github.com/chatmail/chatmail-turn/releases/download/v0.3/chatmail-turn-aarch64-linux", "https://github.com/chatmail/chatmail-turn/releases/download/v0.4/chatmail-turn-aarch64-linux",
"a5fc2d06d937b56a34e098d2cd72a82d3e89967518d159bf246dc69b65e81b42", "0fb3e792419494e21ecad536464929dba706bb2c88884ed8f1788141d26fc756",
), ),
}[host.get_fact(facts.server.Arch)] }[host.get_fact(facts.server.Arch)]

View File

@@ -9,16 +9,16 @@ def parse_zone_records(text):
Skips comment lines (starting with ``;``) and blank lines. Skips comment lines (starting with ``;``) and blank lines.
Each record line must have the format ``name TTL IN type rdata``. Each record line must have the format ``name TTL IN type rdata``.
""" """
for raw_line in text.strip().splitlines(): for raw_line in text.splitlines():
line = raw_line.strip() line = raw_line.strip()
if not line or line.startswith(";"): if not line or line.startswith(";"):
continue continue
parts = line.split(None, 4) try:
if len(parts) < 5: name, ttl, _in, rtype, rdata = line.split(None, 4)
raise ValueError(f"Bad zone record line: {line}") except ValueError:
name = parts[0].rstrip(".") raise ValueError(f"Bad zone record line: {line!r}") from None
# parts[2] is the IN class — ignored name = name.rstrip(".")
yield name, parts[1], parts[3].upper(), parts[4] yield name, ttl, rtype.upper(), rdata
def get_initial_remote_data(sshexec, mail_domain): def get_initial_remote_data(sshexec, mail_domain):

View File

@@ -125,6 +125,27 @@ class TestPerformInitialChecks:
assert not l assert not l
def test_parse_zone_records():
text = """
; This is a comment
some.domain. 3600 IN A 1.1.1.1
; Another comment
www.some.domain. 3600 IN CNAME some.domain.
"""
records = list(parse_zone_records(text))
assert records == [
("some.domain", "3600", "A", "1.1.1.1"),
("www.some.domain", "3600", "CNAME", "some.domain."),
]
def test_parse_zone_records_invalid_line():
text = "invalid line"
with pytest.raises(ValueError, match="Bad zone record line"):
list(parse_zone_records(text))
def parse_zonefile_into_dict(zonefile, mockdns_base, only_required=False): def parse_zonefile_into_dict(zonefile, mockdns_base, only_required=False):
if only_required: if only_required:
# Only take records before the "; Recommended" section # Only take records before the "; Recommended" section

View File

@@ -43,7 +43,6 @@ def relay_container(lxc_setup):
@pytest.fixture @pytest.fixture
def cmdeploy(): def cmdeploy():
def run(*args): def run(*args):
return subprocess.run( return subprocess.run(
[sys.executable, "-m", "cmdeploy.cmdeploy", *args], [sys.executable, "-m", "cmdeploy.cmdeploy", *args],
@@ -127,7 +126,6 @@ class TestLxcStatus:
assert "status" in result.stdout.lower() assert "status" in result.stdout.lower()
def test_shows_containers(self, lxc_setup, capsys): def test_shows_containers(self, lxc_setup, capsys):
class QuietOut: class QuietOut:
def red(self, msg, **kw): def red(self, msg, **kw):
pass pass
@@ -142,7 +140,6 @@ class TestLxcStatus:
assert "running" in captured assert "running" in captured
def test_deploy_freshness(self, ix, monkeypatch): def test_deploy_freshness(self, ix, monkeypatch):
ct = ix.get_container("x") ct = ix.get_container("x")
monkeypatch.setattr( monkeypatch.setattr(

View File

@@ -1,4 +1,3 @@
from cmdeploy.util import collapse, get_git_hash, get_version_string, shell from cmdeploy.util import collapse, get_git_hash, get_version_string, shell

View File

@@ -279,10 +279,3 @@ deployment in several ways:
These are not globally routable, but are sufficient for testing IPv6 service binding These are not globally routable, but are sufficient for testing IPv6 service binding
(Postfix, Dovecot, Nginx) and DNS AAAA records inside the local environment. (Postfix, Dovecot, Nginx) and DNS AAAA records inside the local environment.
test1 runs with ``disable_ipv6 = True`` to exercise the IPv4-only deployment path. test1 runs with ``disable_ipv6 = True`` to exercise the IPv4-only deployment path.
**TURN server does not start**:
``chatmail-turn`` discovers its listen addresses by enumerating globally routable IPs but
LXC containers only have private RFC 1918 addresses (``10.x.x.x``),
so the address list is empty and the server exits immediately.
`PR #11 on chatmail-turn <https://github.com/chatmail/chatmail-turn/pull/11>`_
is meant to fix this.