1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

sync accepts file handle for plan output

This commit is contained in:
Christian Funkhouser
2021-04-07 16:00:05 -04:00
parent 81b68de097
commit 090dbe3515

View File

@@ -9,6 +9,7 @@ from concurrent.futures import ThreadPoolExecutor
from importlib import import_module
from os import environ
from six import text_type
from sys import stdout
import logging
from .provider.base import BaseProvider
@@ -267,7 +268,7 @@ class Manager(object):
return plans, zone
def sync(self, eligible_zones=[], eligible_sources=[], eligible_targets=[],
dry_run=True, force=False):
dry_run=True, force=False, plan_output_fh=stdout):
self.log.info('sync: eligible_zones=%s, eligible_targets=%s, '
'dry_run=%s, force=%s', eligible_zones, eligible_targets,
dry_run, force)
@@ -276,7 +277,7 @@ class Manager(object):
if eligible_zones:
zones = [z for z in zones if z[0] in eligible_zones]
aliased_zones = {}
aliased_zones = {}
futures = []
for zone_name, config in zones:
self.log.info('sync: zone=%s', zone_name)
@@ -402,7 +403,7 @@ class Manager(object):
plans.sort(key=self._plan_keyer, reverse=True)
for output in self.plan_outputs.values():
output.run(plans=plans, log=self.log)
output.run(plans=plans, log=self.log, fh=plan_output_fh)
if not force:
self.log.debug('sync: checking safety')