octodns.processor.restrict
Classes
|
Ensure that configured TTLs are between a configured minimum and maximum or in an allowed set of values. |
Exceptions
- exception octodns.processor.restrict.RestrictionException[source]
Bases:
ProcessorException
- class octodns.processor.restrict.TtlRestrictionFilter(name, min_ttl=1, max_ttl=604800, allowed_ttls=None, **kwargs)[source]
Bases:
BaseProcessorEnsure 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 usage:
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, **kwargs)[source]
Initialize the processor.
- Parameters:
Note
The
nameparameter is deprecated and will be removed in version 2.0. Useidinstead.
- process_source_zone(zone, sources, lenient=False)[source]
Process the desired zone after all sources have populated.
Called after all sources have completed populate. Provides an opportunity for the processor to modify the desired zone that targets will receive.
- Parameters:
desired (octodns.zone.Zone) – The desired zone state after all sources have populated. This zone will be used as the target state for planning.
sources (list[octodns.provider.base.BaseProvider]) – List of source providers that populated the zone. May be empty for aliased zones.
lenient (bool) – When True, relaxed validation rules should be applied when modifying zone records.
- Returns:
The modified desired zone, typically the same object passed in.
- Return type:
octodns.zone.Zone
Important
Will see
desiredafter any modifications done byProvider._process_desired_zoneand processors configured to run before this one.May modify
desireddirectly.Must return
desiredwhich will normally be thedesiredparam.Must not modify records directly;
record.copyshould be called, the results of which can be modified, and thenZone.add_recordmay be used withreplace=True.May call
Zone.remove_recordto remove records fromdesired.Sources may be empty, as will be the case for aliased zones.
Implementations should combine
self.lenient or lenientand pass the result to any record and zone calls that acceptlenientas a parameter, e.g.zone.add_record(..., lenient=lenient).