Merge "make transformers optional in pipeline"

This commit is contained in:
Jenkins 2015-01-14 15:14:41 +00:00 committed by Gerrit Code Review
commit d81616bbae
2 changed files with 3 additions and 4 deletions

View File

@ -242,7 +242,7 @@ class Sink(object):
try:
self.name = cfg['name']
# It's legal to have no transformer specified
self.transformer_cfg = cfg['transformers'] or []
self.transformer_cfg = cfg.get('transformers') or []
except KeyError as err:
raise PipelineException(
"Required field %s not specified" % err.args[0], cfg)
@ -266,9 +266,8 @@ class Sink(object):
return self.name
def _setup_transformers(self, cfg, transformer_manager):
transformer_cfg = cfg['transformers'] or []
transformers = []
for transformer in transformer_cfg:
for transformer in self.transformer_cfg:
parameter = transformer['parameters'] or {}
try:
ext = transformer_manager.get_ext(transformer['name'])

View File

@ -199,7 +199,7 @@ class BasePipelineTestCase(base.BaseTestCase):
def test_no_transformers(self):
self._unset_pipeline_cfg('transformers')
self._exception_create_pipelinemanager()
pipeline.PipelineManager(self.pipeline_cfg, self.transformer_manager)
def test_no_name(self):
self._unset_pipeline_cfg('name')