3636 'v300_defaults_file_removal' ,
3737 'v300_pipeline_file_removal' ,
3838 'v301_deprecations' ,
39+ 'v310_feed_changes' ,
3940 ]
4041
4142
@@ -725,6 +726,29 @@ def v301_deprecations(configuration, harmonization, dry_run, **kwargs):
725726 return messages + ' Remove affected bots yourself.' if messages else changed , configuration , harmonization
726727
727728
729+ def v310_feed_changes (configuration , harmonization , dry_run , ** kwargs ):
730+ """
731+ Migrates feeds' configuration for changed/fixed parameter
732+ """
733+ found_autoshun = []
734+ messages = []
735+ for bot_id , bot in configuration .items ():
736+ if bot_id == 'global' :
737+ continue
738+ if bot ["module" ] == "intelmq.bots.collectors.http.collector" :
739+ if "http_url" not in bot ["parameters" ]:
740+ continue
741+ if 'autoshun.org' in bot ["parameters" ]["http_url" ]:
742+ found_autoshun .append (bot_id )
743+ if bot ["module" ] == "intelmq.bots.parsers.autoshun.parser" :
744+ found_autoshun .append (bot_id )
745+ if found_autoshun :
746+ messages .append ('A discontinued feed "Autoshun" has been found '
747+ f'as bot { ", " .join (sorted (found_autoshun ))} .' )
748+ messages = ' ' .join (messages )
749+ return messages + ' Remove affected bots yourself.' if messages else None , configuration , harmonization
750+
751+
728752UPGRADES = OrderedDict ([
729753 ((1 , 0 , 0 , 'dev7' ), (v100_dev7_modify_syntax , )),
730754 ((1 , 1 , 0 ), (v110_shadowserver_feednames , v110_deprecations )),
@@ -749,7 +773,7 @@ def v301_deprecations(configuration, harmonization, dry_run, **kwargs):
749773 ((3 , 0 , 0 ), (v300_bots_file_removal , v300_defaults_file_removal , v300_pipeline_file_removal , )),
750774 ((3 , 0 , 1 ), (v301_deprecations , )),
751775 ((3 , 0 , 2 ), ()),
752- ((3 , 1 , 0 ), ()),
776+ ((3 , 1 , 0 ), (v310_feed_changes , )),
753777])
754778
755779ALWAYS = (harmonization , )
0 commit comments