Fix CI system to work on both Python 2 and 3 (#225)

* Use old style middleware settings for Python 2.

* Make entrypoint python2 and 3 compatible.

* Fix python command to test for mysql server.

* Bettery docker-entrypoint to work with Python 2 & 3

* Add missing braces.
This commit is contained in:
Abhilash Raj
2018-03-09 23:13:57 -08:00
committed by GitHub
parent 14d8e8071c
commit d26c402617
2 changed files with 19 additions and 3 deletions

View File

@@ -16,7 +16,15 @@ function wait_for_postgres () {
function wait_for_mysql () {
# Check if MySQL is up and accepting connections.
HOSTNAME=$(python -c "from urllib.parse import urlparse; o = urlparse('$DATABASE_URL'); print(o.hostname);")
HOSTNAME=$(python <<EOF
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
o = urlparse('$DATABASE_URL')
print(o.hostname)
EOF
)
until mysqladmin ping --host "$HOSTNAME" --silent; do
>&2 echo "MySQL is unavailable - sleeping"
sleep 1