You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2019/02/01 20:33:18 UTC

[GitHub] ocket8888 commented on a change in pull request #3287: CIAB: Fix Traffic Vault Enrollment

ocket8888 commented on a change in pull request #3287: CIAB: Fix Traffic Vault Enrollment
URL: https://github.com/apache/trafficcontrol/pull/3287#discussion_r253190363
 
 

 ##########
 File path: infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
 ##########
 @@ -168,85 +172,68 @@ to-enroll() {
 	else
 		export MY_CDN="CDN-in-a-Box"
 	fi
+	if [[ ! -z "$3" ]]; then
+		export MY_CACHE_GROUP="$3"
+	else
+		export MY_CACHE_GROUP="CDN_in_a_Box_Edge"
+	fi
+	if [[ ! -z "$4" ]]; then
+		export MY_TCP_PORT="$4"
+	else
+		export MY_TCP_PORT="80"
+	fi
+	if [[ ! -z "$5" ]]; then
+		export MY_HTTP_PORT="$5"
+	else
+		export MY_HTTP_PORT="443"
+	fi
 
 	export MY_NET_INTERFACE='eth0'
 	export MY_DOMAINNAME="$(dnsdomainname)"
-	export MY_IP="$(ifconfig $MY_NET_INTERFACE | grep 'inet ' | tr -s ' ' | cut -d ' ' -f 3)"
+	MY_IP="$(ifconfig $MY_NET_INTERFACE | grep 'inet ' | tr -s ' ' | cut -d ' ' -f 3)"
+	export MY_IP=${MY_IP#"addr:"}
 	export MY_GATEWAY="$(route -n | grep $MY_NET_INTERFACE | grep -E '^0\.0\.0\.0' | tr -s ' ' | cut -d ' ' -f2)"
-	export MY_NETMASK="$(ifconfig $MY_NET_INTERFACE | grep 'inet ' | tr -s ' ' | cut -d ' ' -f 5)"
-	export MY_IP6_ADDRESS="$(ifconfig $MY_NET_INTERFACE | grep inet6 | grep global | awk '{ print $2 }')"
+	MY_NETMASK="$(ifconfig $MY_NET_INTERFACE | grep 'inet ' | tr -s ' ' | cut -d ' ' -f 5)"
+	export MY_NETMASK=${MY_NETMASK#"Mask:"}
+	MY_IP6_ADDRESS="$(ifconfig $MY_NET_INTERFACE | grep inet6 | grep -i global | sed 's/addr://' | awk '{ print $2 }')"
+	export MY_IP6_ADDRESS=${MY_IP6_ADDRESS%%/*}
 	export MY_IP6_GATEWAY="$(route -n6 | grep UG | awk '{print $2}')"
 
 	case "$serverType" in
 		"edge" )
 			export MY_TYPE="EDGE"
 			export MY_PROFILE="ATS_EDGE_TIER_CACHE"
 			export MY_STATUS="REPORTED"
-			if [[ ! -z "$3" ]]; then
-				export MY_CACHE_GROUP="$3"
-			else
-				export MY_CACHE_GROUP="CDN_in_a_Box_Edge"
-			fi
 			;;
 		"mid" )
 			export MY_TYPE="MID"
 			export MY_PROFILE="ATS_MID_TIER_CACHE"
 			export MY_STATUS="REPORTED"
-			if [[ ! -z "$3" ]]; then
-				export MY_CACHE_GROUP="$3"
 
 Review comment:
   I think this will break. The mid's `run.sh` is calling `to-enroll` without specifying a Cache Group. Haven't looked at any of the others, but I suspect they do the same thing - which in their case is fine because it by and large won't matter which Cache Group they are placed into.

----------------------------------------------------------------
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