octodns.record.dynamic

Classes

DynamicValidator(id[, sets])

Validates the dynamic block of a dynamic record: the pools structure (fallback chains, value types, status flags), the rules list (geo/subnet targeting and pool references), and that no pools are defined but unused.

class octodns.record.dynamic.DynamicValidator(id, sets=None)[source]

Bases: RecordValidator

Validates the dynamic block of a dynamic record: the pools structure (fallback chains, value types, status flags), the rules list (geo/subnet targeting and pool references), and that no pools are defined but unused.

validate(record_cls, name, fqdn, data)[source]

Validate a record’s non-value attributes.

Parameters:
  • record_cls (type) – The concrete Record subclass being validated. Validators that need access to record class-level attributes (e.g. _type, _value_type) should read them from record_cls. Per-instance configuration should live on self, not on record_cls.

  • name (str) – The record’s name relative to its zone ('' for the zone root). Already idna_encode’d.

  • fqdn (str) – The record’s fully-qualified domain name (name + zone name).

  • data (dict) – The raw record config dict (as loaded from YAML/JSON) including ttl, type, value/values, and any type-specific fields like dynamic, geo, or octodns.

Returns:

A list of human-readable reason strings describing validation failures. Must return an empty list when the record is valid. Reasons from multiple validators are concatenated by the caller, so each reason must stand alone without context from the others.

Return type:

list[str]

Notes

Implementations must not raise on invalid input — all failures are reported via the returned list. Reason strings are surfaced verbatim in ValidationError messages, so phrasing and punctuation should be stable across releases.

class octodns.record.dynamic._DynamicPool(_id, data, value_type)[source]

Bases: object

log = <Logger _DynamicPool (WARNING)>
__init__(_id, data, value_type)[source]
_data()[source]
__repr__()[source]

Return repr(self).

class octodns.record.dynamic._DynamicRule(i, data)[source]

Bases: object

__init__(i, data)[source]
_data()[source]
__repr__()[source]

Return repr(self).

class octodns.record.dynamic._Dynamic(pools, rules)[source]

Bases: object

__init__(pools, rules)[source]
_data()[source]
__repr__()[source]

Return repr(self).

class octodns.record.dynamic._DynamicMixin(zone, name, data, *args, **kwargs)[source]

Bases: object

VALIDATORS = [<octodns.record.dynamic.DynamicValidator object>]
geo_re = re.compile('^(?P<continent_code>\\w\\w)(-(?P<country_code>\\w\\w)(-(?P<subdivision_code>\\w\\w))?)?$')
classmethod _schema(value_schema)[source]

JSON Schema fragment describing the dynamic block.

Structural constraints that JSON Schema can express cleanly (shape of pools, values, rules, weight/status ranges) are included. Rule ordering, fallback-loop detection, and cross-references between rules and pools are left to octoDNS’s own validation.

classmethod _validate_pools(pools)[source]
classmethod _validate_rules(pools, rules)[source]
__init__(zone, name, data, *args, **kwargs)[source]
_data()[source]
changes(other, target)[source]
__repr__()[source]

Return repr(self).