mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
address link2xt comments (zone parsing and turn v0.4 release
This commit is contained in:
@@ -343,12 +343,12 @@ class TurnDeployer(Deployer):
|
||||
def install(self):
|
||||
(url, sha256sum) = {
|
||||
"x86_64": (
|
||||
"https://github.com/chatmail/chatmail-turn/releases/download/v0.3/chatmail-turn-x86_64-linux",
|
||||
"841e527c15fdc2940b0469e206188ea8f0af48533be12ecb8098520f813d41e4",
|
||||
"https://github.com/chatmail/chatmail-turn/releases/download/v0.4/chatmail-turn-x86_64-linux",
|
||||
"1ec1f5c50122165e858a5a91bcba9037a28aa8cb8b64b8db570aa457c6141a8a",
|
||||
),
|
||||
"aarch64": (
|
||||
"https://github.com/chatmail/chatmail-turn/releases/download/v0.3/chatmail-turn-aarch64-linux",
|
||||
"a5fc2d06d937b56a34e098d2cd72a82d3e89967518d159bf246dc69b65e81b42",
|
||||
"https://github.com/chatmail/chatmail-turn/releases/download/v0.4/chatmail-turn-aarch64-linux",
|
||||
"0fb3e792419494e21ecad536464929dba706bb2c88884ed8f1788141d26fc756",
|
||||
),
|
||||
}[host.get_fact(facts.server.Arch)]
|
||||
|
||||
|
||||
@@ -9,16 +9,16 @@ def parse_zone_records(text):
|
||||
Skips comment lines (starting with ``;``) and blank lines.
|
||||
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()
|
||||
if not line or line.startswith(";"):
|
||||
continue
|
||||
parts = line.split(None, 4)
|
||||
if len(parts) < 5:
|
||||
raise ValueError(f"Bad zone record line: {line}")
|
||||
name = parts[0].rstrip(".")
|
||||
# parts[2] is the IN class — ignored
|
||||
yield name, parts[1], parts[3].upper(), parts[4]
|
||||
try:
|
||||
name, ttl, _in, rtype, rdata = line.split(None, 4)
|
||||
except ValueError:
|
||||
raise ValueError(f"Bad zone record line: {line!r}") from None
|
||||
name = name.rstrip(".")
|
||||
yield name, ttl, rtype.upper(), rdata
|
||||
|
||||
|
||||
def get_initial_remote_data(sshexec, mail_domain):
|
||||
|
||||
@@ -125,6 +125,27 @@ class TestPerformInitialChecks:
|
||||
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):
|
||||
if only_required:
|
||||
# Only take records before the "; Recommended" section
|
||||
|
||||
@@ -43,7 +43,6 @@ def relay_container(lxc_setup):
|
||||
|
||||
@pytest.fixture
|
||||
def cmdeploy():
|
||||
|
||||
def run(*args):
|
||||
return subprocess.run(
|
||||
[sys.executable, "-m", "cmdeploy.cmdeploy", *args],
|
||||
@@ -127,7 +126,6 @@ class TestLxcStatus:
|
||||
assert "status" in result.stdout.lower()
|
||||
|
||||
def test_shows_containers(self, lxc_setup, capsys):
|
||||
|
||||
class QuietOut:
|
||||
def red(self, msg, **kw):
|
||||
pass
|
||||
@@ -142,7 +140,6 @@ class TestLxcStatus:
|
||||
assert "running" in captured
|
||||
|
||||
def test_deploy_freshness(self, ix, monkeypatch):
|
||||
|
||||
ct = ix.get_container("x")
|
||||
|
||||
monkeypatch.setattr(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
from cmdeploy.util import collapse, get_git_hash, get_version_string, shell
|
||||
|
||||
|
||||
|
||||
@@ -279,10 +279,3 @@ deployment in several ways:
|
||||
These are not globally routable, but are sufficient for testing IPv6 service binding
|
||||
(Postfix, Dovecot, Nginx) and DNS AAAA records inside the local environment.
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user