TXT records from metadata work now!

This commit is contained in:
Kalzu Rekku 2025-05-03 15:10:39 +03:00
parent cb2beade61
commit ad449d5ac2

View File

@ -1173,21 +1173,14 @@ class MiniDiscoveryResolver(common.ResolverBase):
f"DNS TXT: Attempting to create Record_TXT for instance {instance_id_str} with {num_segments} segments..."
)
# **** THE KEY WORKAROUND ****
if num_segments == 1:
# If only one segment, pass the bytes object directly
payload_data = final_txt_payload_segments[0]
print(" (Payload is single segment, passing bytes directly)")
else:
# If multiple segments, pass the list (MUST use list/tuple here)
payload_data = final_txt_payload_segments # Pass the list
print(
f" (Payload has {num_segments} segments, passing sequence)"
)
# **** END WORKAROUND ****
# Instantiate Record_TXT by unpacking the list of segments
payload = dns.Record_TXT(
*final_txt_payload_segments, ttl=DNS_DEFAULT_TTL
)
print(
f" (Payload has {num_segments} segments, unpacked and passed to Record_TXT)"
)
# Instantiate Record_TXT with the correctly structured data
payload = dns.Record_TXT(payload_data, ttl=DNS_DEFAULT_TTL)
print(
f"DNS TXT: Record_TXT created successfully for {instance_id_str}."
)