mirror of
https://github.com/Such-Software/adaptive-multi-protocol-gateway.git
synced 2026-10-17 07:31:32 +02:00
Write Dynadot records under the names Dynadot expects (#6)
The write path sent value1 and value2. Dynadot uses record_value1 and record_value2 in both directions and answered with "if record_type is entered, record_value1 must be entered", which reads like a missing value rather than a misnamed one. I corrected the reader for exactly this last time and left the writer alone, having concluded the two spellings differed. They do not. The unit test agreed with the code rather than with Dynadot, so it passed while every write was refused. That is now twice, in opposite directions, with a green suite each time. So this adds a round trip: read a zone, write it straight back, and assert nothing changed. It feeds the writer exactly what the reader produced, so a spelling the two do not share shows up as a value that vanished, and it fails against the code as it was. Worth the care because set_hosts replaces the whole zone. A record the reader drops or the writer misnames is a record deleted from a live domain, and the first zone we are writing is a shop. Co-authored-by: jw <jw@jwmacbookm5.local>
This commit is contained in:
+8
-2
@@ -312,9 +312,15 @@ class DynadotDNSProvider:
|
||||
record_type = record.type.upper()
|
||||
if record_type not in DYNADOT_SUPPORTED_RECORD_TYPES:
|
||||
raise ValueError("Dynadot record type is unsupported")
|
||||
# record_value1, not value1. Dynadot uses the same spelling in both
|
||||
# directions; the reader was corrected to accept it and the writer
|
||||
# was left alone on the assumption that the two differed. They do
|
||||
# not, and Dynadot answers a write in the old spelling with "if
|
||||
# record_type is entered, record_value1 must be entered", which
|
||||
# reads like a missing value rather than a misnamed one.
|
||||
item = {
|
||||
"record_type": record_type,
|
||||
"value1": record.value,
|
||||
"record_value1": record.value,
|
||||
}
|
||||
value2 = (
|
||||
str(record.mx_pref)
|
||||
@@ -324,7 +330,7 @@ class DynadotDNSProvider:
|
||||
if record_type == "MX" and record.mx_pref is None:
|
||||
raise ValueError("Dynadot MX records require mx_pref")
|
||||
if value2 is not None:
|
||||
item["value2"] = value2
|
||||
item["record_value2"] = value2
|
||||
normalized_name = record.name.strip().rstrip(".").lower() or "@"
|
||||
if normalized_name == "@":
|
||||
main.append(item)
|
||||
|
||||
Reference in New Issue
Block a user