Vorschau zeigt die Namen der unverändert mitgesendeten Formularfelder
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b79ce78baf
commit
cd734a6de2
3 files changed
+9
-5
No files matched your search
+6
-4
@@ -391,6 +391,7 @@ class ChangePlan:
|
||||
after: DnsRecord | None
|
||||
records: tuple[DnsRecord, ...]
|
||||
zone_state: str
|
||||
preserved_fields: tuple[str, ...] = ()
|
||||
|
||||
def fingerprint(self) -> str:
|
||||
return "|".join([
|
||||
@@ -619,6 +620,7 @@ class StratoClient:
|
||||
form = form or self._get_dns_form()
|
||||
records = list(form.records)
|
||||
state = _zone_state(form)
|
||||
extras = tuple(dict.fromkeys(name for name, _ in form.extra_fields))
|
||||
|
||||
def find_one() -> DnsRecord:
|
||||
matches = self._at(records, record_type, name)
|
||||
@@ -642,12 +644,12 @@ class StratoClient:
|
||||
if any(r.type == "TXT" and _same_value("TXT", r.value, new_value) for r in same_name):
|
||||
raise StratoError("This exact TXT record already exists")
|
||||
created = DnsRecord(record_type, name, new_value)
|
||||
return ChangePlan("create", record_type, None, created, tuple([*records, created]), state)
|
||||
return ChangePlan("create", record_type, None, created, tuple([*records, created]), state, extras)
|
||||
|
||||
current = find_one()
|
||||
if action == "delete":
|
||||
remaining = tuple(r for r in records if r is not current)
|
||||
return ChangePlan("delete", record_type, current, None, remaining, state)
|
||||
return ChangePlan("delete", record_type, current, None, remaining, state, extras)
|
||||
|
||||
destination = normalize_prefix(record_type, new_prefix, self.config.domain) if new_prefix else name
|
||||
new_value = normalize_value(record_type, value) if value is not None else current.value
|
||||
@@ -661,7 +663,7 @@ class StratoClient:
|
||||
if replacement == current:
|
||||
raise StratoError("The update would not change anything")
|
||||
updated = tuple(replacement if r is current else r for r in records)
|
||||
return ChangePlan("update", record_type, current, replacement, updated, state)
|
||||
return ChangePlan("update", record_type, current, replacement, updated, state, extras)
|
||||
|
||||
def apply(self, plan: ChangePlan) -> ChangePlan:
|
||||
"""Write a previewed plan if the zone still matches it, then verify."""
|
||||
@@ -698,7 +700,7 @@ class StratoClient:
|
||||
found = present(plan.after)
|
||||
if len(found) != 1:
|
||||
raise StratoError(f"STRATO did not persist the {plan.record_type} {plan.action}")
|
||||
plan = ChangePlan(plan.action, plan.record_type, plan.before, found[0], plan.records, plan.zone_state)
|
||||
plan = ChangePlan(plan.action, plan.record_type, plan.before, found[0], plan.records, plan.zone_state, plan.preserved_fields)
|
||||
# update and delete always change the old record, so it must be gone now
|
||||
if plan.before is not None and present(plan.before):
|
||||
raise StratoError(f"STRATO did not remove the old {plan.record_type} record")
|
||||
|
||||
Reference in new issue
Block a user