Skip to content

Commit

Permalink
Fix Travis install script
Browse files Browse the repository at this point in the history
Follow if response code is 301
Use python instead of grep to determine preferred mirror from JSON
  • Loading branch information
tsegismont committed Apr 28, 2016
1 parent 3d3c5f5 commit c1db087
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .travis.install.cassandra.sh
Expand Up @@ -25,9 +25,9 @@ C_MAJOR="3"
C_MINOR="5"

# Find the closest Apache mirror
APACHE_MIRROR="$(curl --silent https://www.apache.org/dyn/closer.cgi?asjson=1 | grep "preferred" | sed -e 's/ *"preferred" *: *"\([^"]*\)"/\1/')"
APACHE_MIRROR="$(curl -sL https://www.apache.org/dyn/closer.cgi?asjson=1 | python -c 'import sys, json; print json.load(sys.stdin)["preferred"]')"

VERSIONS_LIST="$(curl --silent ${APACHE_MIRROR}/cassandra/ | grep -o -E "href=\"${C_MAJOR}\.${C_MINOR}(\.[0-9]+)*/" | grep -o -E "${C_MAJOR}\.${C_MINOR}(\.[0-9]+)*")"
VERSIONS_LIST="$(curl -sL ${APACHE_MIRROR}/cassandra/ | grep -o -E "href=\"${C_MAJOR}\.${C_MINOR}(\.[0-9]+)*/" | grep -o -E "${C_MAJOR}\.${C_MINOR}(\.[0-9]+)*")"
CASSANDRA_VERSION="$(echo "${VERSIONS_LIST}" | sort --version-sort --reverse | head --lines=1)"

CASSANDRA_BINARY="apache-cassandra-${CASSANDRA_VERSION}-bin.tar.gz"
Expand Down

0 comments on commit c1db087

Please sign in to comment.