octodns.processor.meta
Classes
|
Add a special metadata record with timestamps, UUIDs, versions, and/or provider name. |
- class octodns.processor.meta.MetaProcessor(id, record_name='meta', include_time=True, include_uuid=False, include_version=False, include_provider=False, include_extra=None, ttl=60, **kwargs)[source]
Bases:
BaseProcessorAdd a special metadata record with timestamps, UUIDs, versions, and/or provider name. Will only be updated when there are other changes being made. A useful tool to aid in debugging and monitoring of DNS infrastructure.
Timestamps or UUIDs can be useful in checking whether changes are propagating, either from a provider’s backend to their servers or via AXFRs.
Provider can be utilized to determine which DNS system responded to a query when things are operating in dual authority or split horizon setups.
Creates a TXT record with the name configured with values based on processor settings. Values are in the form key=<value>, e.g. time=2023-09-10T05:49:04.246953
- processors:
- meta:
class: octodns.processor.meta.MetaProcessor # The name to use for the meta record. # (default: meta) record_name: meta # Include a timestamp with a UTC value indicating the timeframe when the # last change was made. # (default: true) include_time: true # Include a UUID that can be utilized to uniquely identify the run # pushing data # (default: false) include_uuid: false # Include the provider id for the target where data is being pushed # (default: false) include_provider: false # Include the octoDNS version being used # (default: false) include_version: false # Extra values to set on the records # (default: None) #include_extra: # key: val # foo: env/BAR
- __init__(id, record_name='meta', include_time=True, include_uuid=False, include_version=False, include_provider=False, include_extra=None, ttl=60, **kwargs)[source]
Initialize the processor.
- Parameters:
Note
The
nameparameter is deprecated and will be removed in version 2.0. Useidinstead.
- process_source_and_target_zones(desired, existing, target, lenient=False)[source]
Process both desired and existing zones before computing changes.
Called just prior to computing changes for the target provider between
desiredandexisting. Provides an opportunity for the processor to modify either or both zones that will be used to compute the changes and create the initial plan.- Parameters:
desired (octodns.zone.Zone) – The desired zone state after all source processing.
existing (octodns.zone.Zone) – The existing zone state after all target processing.
target (octodns.provider.base.BaseProvider) – The target provider for which changes will be computed.
lenient (bool) – When True, relaxed validation rules should be applied when modifying zone records.
- Returns:
A tuple of (desired, existing) zones, typically the same objects passed in.
- Return type:
Important
Will see
desiredafter any modifications done byProvider._process_desired_zoneand all processors viaProcessor.process_source_zone.Will see
existingafter any modifications done by all processors viaProcessor.process_target_zone.Will see both
desiredandexistingafter any modifications done by any processors configured to run before this one viaProcessor.process_source_and_target_zones.May modify
desireddirectly.Must return
desiredwhich will normally be thedesiredparam.May modify
existingdirectly.Must return
existingwhich will normally be theexistingparam.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.May call
Zone.remove_recordto remove records fromexisting.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).
- process_plan(plan, sources, target, lenient=False)[source]
Process the plan after it has been computed.
Called after the planning phase has completed. Provides an opportunity for the processor to modify the plan, thus changing the actions that will be displayed and potentially applied.
- Parameters:
plan (octodns.provider.plan.Plan or None) – The computed plan containing the changes to be applied. May be None if no changes were detected.
sources (list[octodns.provider.base.BaseProvider]) – List of source providers for this zone. May be empty for aliased zones.
target (octodns.provider.base.BaseProvider) – The target provider for which the plan was created.
lenient (bool) – When True, relaxed validation rules should be applied when modifying zone records.
- Returns:
The modified plan, which may be the same object passed in, a newly created Plan, or None if no changes are needed.
- Return type:
octodns.provider.plan.Plan or None
Important
planmay be None if no changes were detected; if so, aPlanmay still be created and returned.May modify
plan.changesdirectly or create a newPlan.Does not have to modify
plan.desiredand/orplan.existingto line up with any modifications made toplan.changes.Should copy over
plan.exists,plan.update_pcent_threshold, andplan.delete_pcent_thresholdwhen creating a newPlan.Must return a
Planwhich may beplanor can be a newly created one withplan.desiredandplan.existingcopied over as-is or modified.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).