Skip to content

Commit

Permalink
FIX: the pipeline factory expects a dict, not simply a list
Browse files Browse the repository at this point in the history
The `pipeline_args` argument of the pipeline factory should contain a
dict with the relevant attributes and their values instead of simply a
list containing the keys of the attributes.
Also the method itself has to get the values from the dict.
  • Loading branch information
Birger Schacht authored and Birger Schacht committed Mar 8, 2021
1 parent 234b5e1 commit 979af96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion intelmq/lib/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def __check_bot_id(self, name: str):
self.stop()

def __connect_pipelines(self):
pipeline_args = sorted(i for i in dir(self) if not inspect.ismethod(i) and (i.startswith('source_pipeline_') or i.startswith('destination_pipeline')))
pipeline_args = {key: getattr(self, key) for key in dir(self) if not inspect.ismethod(key) and (key.startswith('source_pipeline_') or key.startswith('destination_pipeline'))}
if self.__source_queues:
self.logger.debug("Loading source pipeline and queue %r.", self.__source_queues)
self.__source_pipeline = PipelineFactory.create(logger=self.logger,
Expand Down
4 changes: 2 additions & 2 deletions intelmq/lib/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def create(logger, broker=None, direction=None, queues=None, pipeline_args={}, l
expected=["destination", "source"])

if direction == 'source' and 'source_pipeline_broker' in pipeline_args:
broker = source_pipeline_broker.title()
broker = pipeline_args['source_pipeline_broker'].title()
if direction == 'destination' and 'destination_pipeline_broker' in pipeline_args:
broker = destination_pipeline_broker.title()
broker = pipeline_args['destination_pipeline_broker'].title()
elif (getattr(pipeline_args, 'source_pipeline_broker', None) == getattr(pipeline_args, 'destination_pipeline_broker', None) and
getattr(pipeline_args, 'source_pipeline_broker', None) is not None):
broker = pipeline_args['source_pipeline_broker'].title()
Expand Down

0 comments on commit 979af96

Please sign in to comment.