octodns.processor.restrict

exception octodns.processor.restrict.RestrictionException[source]

Bases: ProcessorException

class octodns.processor.restrict.TtlRestrictionFilter(name, min_ttl=1, max_ttl=604800, allowed_ttls=None)[source]

Bases: BaseProcessor

Ensure that configured TTLs are between a configured minimum and maximum or in an allowed set of values.

The default minimum is 1 (the behavior of 0 is undefined spec-wise) and the default maximum is 604800 (seven days.) allowed_ttls is only used when explicitly configured and min and max are ignored in that case.

Example

processors:
min-max-ttl:
    class: octodns.processor.restrict.TtlRestrictionFilter
    min_ttl: 60
    max_ttl: 3600
    # allowed_ttls: [300, 900, 3600]

zones:
exxampled.com.:
    sources:
    - config
    processors:
    - min-max-ttl
    targets:
    - azure

The restriction can be skipped for specific records by setting the lenient flag, e.g.

a:
octodns:
    lenient: true
ttl: 0
value: 1.2.3.4

The higher level lenient flags are not checked as it would make more sense to just avoid enabling the processor in those cases.

SEVEN_DAYS = 604800
__init__(name, min_ttl=1, max_ttl=604800, allowed_ttls=None)[source]
process_source_zone(zone, *args, **kwargs)[source]

Called after all sources have completed populate. Provides an opportunity for the processor to modify the desired Zone that targets will receive.

  • Will see desired after any modifications done by Provider._process_desired_zone and processors configured to run before this one.

  • May modify desired directly.

  • Must return desired which will normally be the desired param.

  • Must not modify records directly, record.copy should be called, the results of which can be modified, and then Zone.add_record may be used with replace=True.

  • May call Zone.remove_record to remove records from desired.

  • Sources may be empty, as will be the case for aliased zones.