From 9b31e105bdb444028e557c77b23489ede945e8a8 Mon Sep 17 00:00:00 2001 From: Panov Eduard Date: Tue, 23 Jul 2024 12:40:07 +0300 Subject: [PATCH] Fixing behavior when module ignores necessity of topic options update for existing topics if topic provided with default values for partitions and/or replica_factor. --- module_utils/kafka_manager.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/module_utils/kafka_manager.py b/module_utils/kafka_manager.py index 5fc25d5d..f825437b 100644 --- a/module_utils/kafka_manager.py +++ b/module_utils/kafka_manager.py @@ -1499,16 +1499,17 @@ def get_topics_to_update(self, topics): topic['name'] ) ) - topics = [ - topic for topic in topics if ( - topic['partitions'] > 0 and topic['replica_factor'] > 0) - ] topics_changed.update( self.is_topics_configuration_need_update({ topic['name']: topic['options'].items() for topic in topics }) ) + + topics = [ + topic for topic in topics if ( + topic['partitions'] > 0 and topic['replica_factor'] > 0) + ] topics_changed.update( self.is_topics_replication_need_update({ topic['name']: { @@ -1546,10 +1547,6 @@ def ensure_topics(self, topics): ) ) - topics = [ - topic for topic in topics if ( - topic['partitions'] > 0 and topic['replica_factor'] > 0) - ] topics_config_need_update = self.is_topics_configuration_need_update({ topic['name']: topic['options'].items() @@ -1563,6 +1560,10 @@ def ensure_topics(self, topics): }) topics_changed.update(topics_config_need_update) + topics = [ + topic for topic in topics if ( + topic['partitions'] > 0 and topic['replica_factor'] > 0) + ] topics_replication_need_update = \ self.is_topics_replication_need_update({ topic['name']: {