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