octodns.source.tinydns
Classes
|
|
|
A basic TinyDNS zonefile importer created to import legacy data. |
- class octodns.source.tinydns.TinyDnsBaseSource(id, default_ttl=3600)[source]
Bases:
BaseSource- SUPPORTS_GEO = False
- SUPPORTS_DYNAMIC = False
- __init__(id, default_ttl=3600)[source]
Initialize the source.
- Parameters:
id (str) – Unique identifier for this source instance. Used in logging and configuration references.
- Raises:
NotImplementedError – If required class attributes (
log,SUPPORTS_GEO, orSUPPORTS) are not defined in the subclass.
- property SUPPORTS
- _records_for_amp(zone, name, lines, arpa=False)
- SYMBOL_MAP = {'&': <function TinyDnsBaseSource._records_for_dot>, "'": <function TinyDnsBaseSource._records_for_quote>, '+': <function TinyDnsBaseSource._records_for_plus>, '.': <function TinyDnsBaseSource._records_for_dot>, '3': <function TinyDnsBaseSource._records_for_three>, '6': <function TinyDnsBaseSource._records_for_six>, ':': <function TinyDnsBaseSource._records_for_colon>, '=': <function TinyDnsBaseSource._records_for_equal>, '@': <function TinyDnsBaseSource._records_for_at>, 'C': <function TinyDnsBaseSource._records_for_C>, 'S': <function TinyDnsBaseSource._records_for_S>, '^': <function TinyDnsBaseSource._records_for_caret>}
- populate(zone, target=False, lenient=False)[source]
Load DNS records from the source into the provided zone.
This method is responsible for reading DNS data from the source’s backend and adding records to the zone using
zone.add_record(). Subclasses must implement this method.- Parameters:
zone (octodns.zone.Zone) – The zone to populate with records from this source.
target (bool) – If True, the populate call is loading the current state from a target provider (for comparison during sync). If False, loading desired state from a source.
lenient (bool) – If True, skip strict record validation and do a “best effort” load of data. This allows some non-best-practice configurations through (e.g., missing trailing dots or unescaped semicolons).
- Returns:
When
targetis True (loading current state), should return True if the zone exists in the target or False if it does not. Whentargetis False (loading desired state), return value is ignored and may be None.- Return type:
bool or None
- Raises:
NotImplementedError – This base class method must be overridden by subclasses.
Important
Must use
zone.add_record()to add records to the zone.Should not modify the zone name or other zone properties.
When
target=True, must return a boolean indicating zone existence.When
lenient=True, should relax validation to handle common non-standard configurations.
- class octodns.source.tinydns.TinyDnsFileSource(id, directory, default_ttl=3600)[source]
Bases:
TinyDnsBaseSourceA basic TinyDNS zonefile importer created to import legacy data.
- tinydns:
class: octodns.source.tinydns.TinyDnsFileSource # The location of the TinyDNS zone files directory: ./zones # The ttl to use for records when not specified in the data # (optional, default 3600) default_ttl: 3600
NOTE: timestamps & lo fields are ignored if present.
The source intends to conform to and fully support the official spec, https://cr.yp.to/djbdns/tinydns-data.html and the common patch/extensions to support IPv6 and a few other record types, https://docs.bytemark.co.uk/article/tinydns-format/.
- __init__(id, directory, default_ttl=3600)[source]
Initialize the source.
- Parameters:
id (str) – Unique identifier for this source instance. Used in logging and configuration references.
- Raises:
NotImplementedError – If required class attributes (
log,SUPPORTS_GEO, orSUPPORTS) are not defined in the subclass.