From 286e11f081329becd8abb049deac17c2fd00ebe4 Mon Sep 17 00:00:00 2001 From: dynarro Date: Tue, 17 Mar 2015 18:20:29 +0100 Subject: [PATCH] Make the Pipeline inmutable This patch makes pipeline inmutable by removing the append method. the pipeline metadata now returns a pipeline instance. Change-Id: I9b90933a83ca1d423d3718f438d3717c39ef78d4 Closes-Bug: #1433158 --- zaqar/common/pipeline.py | 3 --- zaqar/storage/pipeline.py | 10 +++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/zaqar/common/pipeline.py b/zaqar/common/pipeline.py index be7aa73de..6b552dbf0 100644 --- a/zaqar/common/pipeline.py +++ b/zaqar/common/pipeline.py @@ -45,9 +45,6 @@ class Pipeline(object): def __init__(self, pipeline=None): self._pipeline = pipeline and list(pipeline) or [] - def append(self, stage): - self._pipeline.append(stage) - @decorators.memoized_getattr def __getattr__(self, name): with self.consumer_for(name) as consumer: diff --git a/zaqar/storage/pipeline.py b/zaqar/storage/pipeline.py index 4877217b9..cc15470a8 100644 --- a/zaqar/storage/pipeline.py +++ b/zaqar/storage/pipeline.py @@ -78,7 +78,7 @@ def _get_storage_pipeline(resource_name, conf): {'stage': ns, 'ex': str(exc)}) continue - return common.Pipeline(pipeline) + return pipeline class DataDriver(base.DataDriverBase): @@ -109,22 +109,22 @@ class DataDriver(base.DataDriverBase): def queue_controller(self): stages = _get_storage_pipeline('queue', self.conf) stages.append(self._storage.queue_controller) - return stages + return common.Pipeline(stages) @decorators.lazy_property(write=False) def message_controller(self): stages = _get_storage_pipeline('message', self.conf) stages.append(self._storage.message_controller) - return stages + return common.Pipeline(stages) @decorators.lazy_property(write=False) def claim_controller(self): stages = _get_storage_pipeline('claim', self.conf) stages.append(self._storage.claim_controller) - return stages + return common.Pipeline(stages) @decorators.lazy_property(write=False) def subscription_controller(self): stages = _get_storage_pipeline('subscription', self.conf) stages.append(self._storage.subscription_controller) - return stages + return common.Pipeline(stages)