octodns.source.tinydns

Classes

TinyDnsBaseSource(id[, default_ttl])

TinyDnsFileSource(id, directory[, default_ttl])

A basic TinyDNS zonefile importer created to import legacy data.

octodns.source.tinydns._unique(values)[source]
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, or SUPPORTS) are not defined in the subclass.

property SUPPORTS
_ttl_for(lines, index)[source]
_records_for_at(zone, name, lines, arpa=False)[source]
_records_for_C(zone, name, lines, arpa=False)[source]
_records_for_caret(zone, name, lines, arpa=False)[source]
_records_for_equal(zone, name, lines, arpa=False)[source]
_records_for_dot(zone, name, lines, arpa=False)[source]
_records_for_amp(zone, name, lines, arpa=False)
_records_for_plus(zone, name, lines, arpa=False)[source]
_records_for_quote(zone, name, lines, arpa=False)[source]
_records_for_three(zone, name, lines, arpa=False)[source]
_records_for_S(zone, name, lines, arpa=False)[source]
_records_for_colon(zone, name, lines, arpa=False)[source]
_records_for_six(zone, name, lines, arpa=False)[source]
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>}
_process_lines(zone, lines)[source]
_process_symbols(zone, symbols, arpa)[source]
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 target is True (loading current state), should return True if the zone exists in the target or False if it does not. When target is 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: TinyDnsBaseSource

A 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, or SUPPORTS) are not defined in the subclass.

_lines()[source]