From ad449d5ac2b5e47a80c109149da7ec1a9868782d Mon Sep 17 00:00:00 2001 From: Kalzu Rekku Date: Sat, 3 May 2025 15:10:39 +0300 Subject: [PATCH] TXT records from metadata work now! --- MiniDiscovery.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/MiniDiscovery.py b/MiniDiscovery.py index 3c083ef..dfbaf75 100644 --- a/MiniDiscovery.py +++ b/MiniDiscovery.py @@ -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}." )