Fix duplication in sinks names
When we have sinks with duplicated names, problem occurs: names conflict and we get only one measurment. This patchset will fix it, if sinks have duplicated names, PipelineException raises. Change-Id: I68cb3fd635b0d4cd63be9da3385cb64e0326e558 Closes-bug: 1417278
This commit is contained in:
parent
0bcbaf6d93
commit
e16dbad8ef
@ -623,8 +623,13 @@ class PipelineManager(object):
|
||||
cfg)
|
||||
LOG.info(_('detected decoupled pipeline config format'))
|
||||
sources = [p_type['source'](s) for s in cfg.get('sources', [])]
|
||||
sinks = dict((s['name'], p_type['sink'](s, transformer_manager))
|
||||
for s in cfg.get('sinks', []))
|
||||
sinks = {}
|
||||
for s in cfg.get('sinks', []):
|
||||
if s['name'] in sinks:
|
||||
raise PipelineException("Duplicated sink names: %s" %
|
||||
s['name'], self)
|
||||
else:
|
||||
sinks[s['name']] = p_type['sink'](s, transformer_manager)
|
||||
for source in sources:
|
||||
source.check_sinks(sinks)
|
||||
for target in source.sinks:
|
||||
|
@ -267,3 +267,13 @@ class TestDecoupledPipeline(pipeline_base.BasePipelineTestCase):
|
||||
self._do_test_rate_of_change_in_boilerplate_pipeline_cfg(3,
|
||||
meters,
|
||||
units)
|
||||
|
||||
def test_duplicated_sinks_names(self):
|
||||
self.pipeline_cfg['sinks'].append({
|
||||
'name': 'test_sink',
|
||||
'publishers': ['except'],
|
||||
})
|
||||
self.assertRaises(pipeline.PipelineException,
|
||||
pipeline.PipelineManager,
|
||||
self.pipeline_cfg,
|
||||
self.transformer_manager)
|
||||
|
Loading…
x
Reference in New Issue
Block a user