Polish KarlDNS production UI and docs

This commit is contained in:
StasonJatham committed 2026-05-21 10:05:40 +02:00
1 parent ca92dc211a
commit 5beee0e5c6
61 files changed
+1566 -523

No files matched your search

+2
View File
@@ -3,6 +3,7 @@ from __future__ import annotations
from .base import (
DnsConfigurationError,
DnsProviderError,
DnsReconciliationError,
delete_dns_records,
dns_backend_configured,
publish_dns,
@@ -14,6 +15,7 @@ from .rfc2136 import delete_rfc2136_records, publish_rfc2136
__all__ = [
"DnsConfigurationError",
"DnsProviderError",
"DnsReconciliationError",
"delete_cloudflare_records",
"delete_dns_records",
"delete_rfc2136_records",
+4
View File
@@ -9,6 +9,10 @@ class DnsProviderError(RuntimeError):
"""Raised for expected DNS provider publish/delete failures."""
class DnsReconciliationError(DnsProviderError):
"""Raised when provider read-back does not match the requested DNS state."""
class DnsConfigurationError(RuntimeError):
"""Raised when DNS provider settings are invalid at startup."""
+10 -1
View File
@@ -6,7 +6,7 @@ import urllib.parse
import urllib.request
from ..ddns_models import DdnsSettings, UpdateResult
from .base import DnsProviderError
from .base import DnsProviderError, DnsReconciliationError
def publish_cloudflare(result: UpdateResult, settings: DdnsSettings) -> None:
@@ -45,6 +45,7 @@ def _cloudflare_upsert_record(settings: DdnsSettings, hostname: str, record_type
_cloudflare_request(settings, f"/dns_records/{record['id']}", method="PATCH", payload=payload)
else:
_cloudflare_request(settings, "/dns_records", method="POST", payload=payload)
_cloudflare_reconcile_record(settings, hostname, record_type, value)
def _cloudflare_find_record(settings: DdnsSettings, hostname: str, record_type: str) -> dict[str, str] | None:
@@ -54,6 +55,14 @@ def _cloudflare_find_record(settings: DdnsSettings, hostname: str, record_type:
return records[0] if records else None
def _cloudflare_reconcile_record(settings: DdnsSettings, hostname: str, record_type: str, value: str) -> None:
record = _cloudflare_find_record(settings, hostname, record_type)
if not record:
raise DnsReconciliationError(f"Cloudflare {record_type} record was not visible after publish")
if record.get("content") != value:
raise DnsReconciliationError(f"Cloudflare {record_type} record did not match requested content after publish")
def _cloudflare_request(
settings: DdnsSettings,
path: str,