octodns.processor.meta

Classes

MetaProcessor(id[, record_name, ...])

Add a special metadata record with timestamps, UUIDs, versions, and/or provider name.

octodns.processor.meta._keys(values)[source]
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: BaseProcessor

Add 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

classmethod get_time()[source]
classmethod get_uuid()[source]
__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:
  • name (str) – Unique identifier for this processor instance. Used in logging and configuration references.

  • lenient (bool) – When True, the processor will operate in lenient mode. This value is combined with the per-call lenient parameter in process_* methods.

Note

The name parameter is deprecated and will be removed in version 2.0. Use id instead.

values(target_id)[source]
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 desired and existing. 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:

tuple[octodns.zone.Zone, octodns.zone.Zone]

Important

  • Will see desired after any modifications done by Provider._process_desired_zone and all processors via Processor.process_source_zone.

  • Will see existing after any modifications done by all processors via Processor.process_target_zone.

  • Will see both desired and existing after any modifications done by any processors configured to run before this one via Processor.process_source_and_target_zones.

  • May modify desired directly.

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

  • May modify existing directly.

  • Must return existing which will normally be the existing 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.

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

  • Implementations should combine self.lenient or lenient and pass the result to any record and zone calls that accept lenient as a parameter, e.g. zone.add_record(..., lenient=lenient).

_is_up_to_date_meta(change, target_id)[source]
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:
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

  • plan may be None if no changes were detected; if so, a Plan may still be created and returned.

  • May modify plan.changes directly or create a new Plan.

  • Does not have to modify plan.desired and/or plan.existing to line up with any modifications made to plan.changes.

  • Should copy over plan.exists, plan.update_pcent_threshold, and plan.delete_pcent_threshold when creating a new Plan.

  • Must return a Plan which may be plan or can be a newly created one with plan.desired and plan.existing copied over as-is or modified.

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

  • Implementations should combine self.lenient or lenient and pass the result to any record and zone calls that accept lenient as a parameter, e.g. zone.add_record(..., lenient=lenient).