From 19bfd5beca00cbcea4646f6abc2a0c354a383645 Mon Sep 17 00:00:00 2001 From: reyesj2 <94730068+reyesj2@users.noreply.github.com> Date: Thu, 13 Jun 2024 12:16:39 -0400 Subject: [PATCH] fix kafka nodeid assignment to increment correctly Signed-off-by: reyesj2 <94730068+reyesj2@users.noreply.github.com> --- salt/kafka/nodes.map.jinja | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/salt/kafka/nodes.map.jinja b/salt/kafka/nodes.map.jinja index 3a73b038f..e162d3f08 100644 --- a/salt/kafka/nodes.map.jinja +++ b/salt/kafka/nodes.map.jinja @@ -30,7 +30,7 @@ {% endif %} {# Create list of possible node ids #} -{% set all_possible_ids = range(1, 65536)|list %} +{% set all_possible_ids = range(1, 2000)|list %} {# Create list of available node ids by looping through all_possible_ids and ensuring it isn't in existing_ids #} {% set available_ids = [] %} @@ -44,11 +44,7 @@ {% set NEW_KAFKANODES = {} %} {% for minionid, ip in current_kafkanodes.items() %} {% set hostname = minionid.split('_')[0] %} -{% if STORED_KAFKANODES != none and hostname not in STORED_KAFKANODES.items() %} -{% set new_id = available_ids.pop(0) %} -{% do NEW_KAFKANODES.update({hostname: {'nodeid': new_id, 'ip': ip[0], 'role': process_x_roles }}) %} -{% endif %} -{% if hostname not in NEW_KAFKANODES.items() %} +{% if not STORED_KAFKANODES or hostname not in STORED_KAFKANODES %} {% set new_id = available_ids.pop(0) %} {% do NEW_KAFKANODES.update({hostname: {'nodeid': new_id, 'ip': ip[0], 'role': process_x_roles }}) %} {% endif %}