diff --git a/ceilometer/pipeline.py b/ceilometer/pipeline.py index 46ff1a25..3570530d 100644 --- a/ceilometer/pipeline.py +++ b/ceilometer/pipeline.py @@ -278,15 +278,16 @@ class SampleSource(Source): def __init__(self, cfg): super(SampleSource, self).__init__(cfg) try: - try: - self.interval = int(cfg['interval']) - except ValueError: - raise PipelineException("Invalid interval value", cfg) # Support 'counters' for backward compatibility self.meters = cfg.get('meters', cfg.get('counters')) except KeyError as err: raise PipelineException( "Required field %s not specified" % err.args[0], cfg) + + try: + self.interval = int(cfg.get('interval', 600)) + except ValueError: + raise PipelineException("Invalid interval value", cfg) if self.interval <= 0: raise PipelineException("Interval value should > 0", cfg) diff --git a/ceilometer/tests/pipeline_base.py b/ceilometer/tests/pipeline_base.py index fd747017..2e06dd4e 100644 --- a/ceilometer/tests/pipeline_base.py +++ b/ceilometer/tests/pipeline_base.py @@ -210,7 +210,11 @@ class BasePipelineTestCase(base.BaseTestCase): def test_no_interval(self): self._unset_pipeline_cfg('interval') - self._exception_create_pipelinemanager() + pipeline_manager = pipeline.PipelineManager(self.pipeline_cfg, + self.transformer_manager) + + pipe = pipeline_manager.pipelines[0] + self.assertEqual(600, pipe.get_interval()) def test_no_publishers(self): self._unset_pipeline_cfg('publishers')