Yunyung commented on code in PR #19537:
URL: https://github.com/apache/kafka/pull/19537#discussion_r2065833690


##########
tests/docker/ducker-ak:
##########
@@ -412,14 +421,23 @@ attempting to start new ones."
     exec 3<> "${ducker_dir}/build/node_hosts"
     for n in $(seq -f %02g 1 ${num_nodes}); do
         local node="ducker${n}"
-        docker exec --user=root "${node}" grep "${node}" /etc/hosts >&3
+        if [[ "${ipv6}" == "true" ]]; then
+            docker exec --user=root "${node}" grep "${node}" /etc/hosts | grep 
"${subnet_cidr_prefix}" >&3
+        else
+            docker exec --user=root "${node}" grep "${node}" /etc/hosts >&3
+        fi
         [[ $? -ne 0 ]] && die "failed to find the /etc/hosts entry for ${node}"
     done
     exec 3>&-
     for n in $(seq -f %02g 1 ${num_nodes}); do
         local node="ducker${n}"
         docker exec --user=root "${node}" \
             bash -c "grep -v ${node} 
/opt/kafka-dev/tests/docker/build/node_hosts >> /etc/hosts"
+            # Filter out ipv4 addresses if ipv6
+            if [[ "${ipv6}" == "true" ]]; then
+                docker exec --user=root "${node}" \
+                    bash -c "grep -v -E '([0-9]{1,3}\.){3}[0-9]{1,3}' 
/opt/kafka-dev/tests/docker/build/node_hosts >> /etc/hosts"
+            fi

Review Comment:
   Fix indention.



##########
tests/docker/ducker-ak:
##########
@@ -412,14 +421,23 @@ attempting to start new ones."
     exec 3<> "${ducker_dir}/build/node_hosts"
     for n in $(seq -f %02g 1 ${num_nodes}); do
         local node="ducker${n}"
-        docker exec --user=root "${node}" grep "${node}" /etc/hosts >&3
+        if [[ "${ipv6}" == "true" ]]; then
+            docker exec --user=root "${node}" grep "${node}" /etc/hosts | grep 
"${subnet_cidr_prefix}" >&3
+        else
+            docker exec --user=root "${node}" grep "${node}" /etc/hosts >&3
+        fi
         [[ $? -ne 0 ]] && die "failed to find the /etc/hosts entry for ${node}"
     done
     exec 3>&-
     for n in $(seq -f %02g 1 ${num_nodes}); do
         local node="ducker${n}"
         docker exec --user=root "${node}" \
             bash -c "grep -v ${node} 
/opt/kafka-dev/tests/docker/build/node_hosts >> /etc/hosts"
+            # Filter out ipv4 addresses if ipv6
+            if [[ "${ipv6}" == "true" ]]; then
+                docker exec --user=root "${node}" \
+                    bash -c "grep -v -E '([0-9]{1,3}\.){3}[0-9]{1,3}' 
/opt/kafka-dev/tests/docker/build/node_hosts >> /etc/hosts"
+            fi
         [[ $? -ne 0 ]] && die "failed to append to the /etc/hosts file on 
${node}"

Review Comment:
   We should add this after the two `docker exec` commands.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to