You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/08/01 09:59:42 UTC

[GitHub] twalthr closed pull request #6453: [FLINK-9874][E2E Tests] Fix set_ssl_conf for macOS

twalthr closed pull request #6453: [FLINK-9874][E2E Tests] Fix set_ssl_conf for macOS
URL: https://github.com/apache/flink/pull/6453
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/flink-end-to-end-tests/test-scripts/common.sh b/flink-end-to-end-tests/test-scripts/common.sh
index c78afe74b6d..f428a52c488 100644
--- a/flink-end-to-end-tests/test-scripts/common.sh
+++ b/flink-end-to-end-tests/test-scripts/common.sh
@@ -146,6 +146,27 @@ function create_ha_config() {
 EOL
 }
 
+function get_node_ip {
+    local ip_addr
+
+    if [[ ${OS_TYPE} == "linux" ]]; then
+        ip_addr=$(hostname -I)
+    elif [[ ${OS_TYPE} == "mac" ]]; then
+        ip_addr=$(
+            ifconfig |
+            grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | # grep IPv4 addresses only
+            grep -v 127.0.0.1 |                     # do not use 127.0.0.1 (to be consistent with hostname -I)
+            awk '{ print $2 }' |                    # extract ip from row
+            paste -sd " " -                         # combine everything to one line
+        )
+    else
+        echo "Warning: Unsupported OS_TYPE '${OS_TYPE}' for 'get_node_ip'. Falling back to 'hostname -I' (linux)"
+        ip_addr=$(hostname -I)
+    fi
+
+    echo ${ip_addr}
+}
+
 function set_conf_ssl {
 
     # clean up the dir that will be used for SSL certificates and trust stores
@@ -154,12 +175,15 @@ function set_conf_ssl {
        rm -rf "${TEST_DATA_DIR}/ssl"
     fi
     mkdir -p "${TEST_DATA_DIR}/ssl"
+
     NODENAME=`hostname -f`
     SANSTRING="dns:${NODENAME}"
-    for NODEIP in `hostname -I | cut -d' ' -f1` ; do
+    for NODEIP in $(get_node_ip) ; do
         SANSTRING="${SANSTRING},ip:${NODEIP}"
     done
 
+    echo "Using SAN ${SANSTRING}"
+
     # create certificates
     keytool -genkeypair -alias ca -keystore "${TEST_DATA_DIR}/ssl/ca.keystore" -dname "CN=Sample CA" -storepass password -keypass password -keyalg RSA -ext bc=ca:true
     keytool -keystore "${TEST_DATA_DIR}/ssl/ca.keystore" -storepass password -alias ca -exportcert > "${TEST_DATA_DIR}/ssl/ca.cer"


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services