Skip to content

Commit 6d3a90c

Browse files
committed
Migrate to pg_isready
1 parent 3f7c82d commit 6d3a90c

File tree

6 files changed

+54
-138
lines changed

6 files changed

+54
-138
lines changed

15.0/entrypoint.sh

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,44 @@ fi
1414
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
1515
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
1616

17+
ODOO_ARGS=()
1718
DB_ARGS=()
19+
1820
function check_config() {
1921
param="$1"
2022
value="$2"
23+
pg_flag="$3"
24+
2125
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
2226
value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
2327
fi;
24-
DB_ARGS+=("--${param}")
28+
29+
ODOO_ARGS+=("--${param}")
30+
ODOO_ARGS+=("${value}")
31+
32+
DB_ARGS+=("${pg_flag}")
2533
DB_ARGS+=("${value}")
2634
}
2735

28-
check_config "db_name" "$NAME"
29-
check_config "db_host" "$HOST"
30-
check_config "db_port" "$PORT"
31-
check_config "db_user" "$USER"
32-
check_config "db_password" "$PASSWORD"
36+
check_config "db_name" "$NAME" "-d"
37+
check_config "db_host" "$HOST" "-h"
38+
check_config "db_port" "$PORT" "-p"
39+
check_config "db_user" "$USER" "-U"
40+
# check_config "db_password" "$PASSWORD"
3341

3442
case "$1" in
3543
-- | odoo)
3644
shift
3745
if [[ "$1" == "scaffold" ]] ; then
3846
exec odoo "$@"
3947
else
40-
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
41-
exec odoo "$@" "${DB_ARGS[@]}"
48+
pg_isready ${DB_ARGS[@]} --timeout=30
49+
exec odoo "$@" "${ODOO_ARGS[@]}"
4250
fi
4351
;;
4452
-*)
45-
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
46-
exec odoo "$@" "${DB_ARGS[@]}"
53+
pg_isready ${DB_ARGS[@]} --timeout=30
54+
exec odoo "$@" "${ODOO_ARGS[@]}"
4755
;;
4856
*)
4957
exec "$@"

15.0/wait-for-psql.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

16.0/entrypoint.sh

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,44 @@ fi
1414
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
1515
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
1616

17+
ODOO_ARGS=()
1718
DB_ARGS=()
19+
1820
function check_config() {
1921
param="$1"
2022
value="$2"
23+
pg_flag="$3"
24+
2125
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
2226
value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
2327
fi;
24-
DB_ARGS+=("--${param}")
28+
29+
ODOO_ARGS+=("--${param}")
30+
ODOO_ARGS+=("${value}")
31+
32+
DB_ARGS+=("${pg_flag}")
2533
DB_ARGS+=("${value}")
2634
}
2735

28-
check_config "db_name" "$NAME"
29-
check_config "db_host" "$HOST"
30-
check_config "db_port" "$PORT"
31-
check_config "db_user" "$USER"
32-
check_config "db_password" "$PASSWORD"
36+
check_config "db_name" "$NAME" "-d"
37+
check_config "db_host" "$HOST" "-h"
38+
check_config "db_port" "$PORT" "-p"
39+
check_config "db_user" "$USER" "-U"
40+
# check_config "db_password" "$PASSWORD"
3341

3442
case "$1" in
3543
-- | odoo)
3644
shift
3745
if [[ "$1" == "scaffold" ]] ; then
3846
exec odoo "$@"
3947
else
40-
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
41-
exec odoo "$@" "${DB_ARGS[@]}"
48+
pg_isready ${DB_ARGS[@]} --timeout=30
49+
exec odoo "$@" "${ODOO_ARGS[@]}"
4250
fi
4351
;;
4452
-*)
45-
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
46-
exec odoo "$@" "${DB_ARGS[@]}"
53+
pg_isready ${DB_ARGS[@]} --timeout=30
54+
exec odoo "$@" "${ODOO_ARGS[@]}"
4755
;;
4856
*)
4957
exec "$@"

16.0/wait-for-psql.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

17.0/entrypoint.sh

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,44 @@ fi
1414
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
1515
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
1616

17+
ODOO_ARGS=()
1718
DB_ARGS=()
19+
1820
function check_config() {
1921
param="$1"
2022
value="$2"
23+
pg_flag="$3"
24+
2125
if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then
2226
value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g')
2327
fi;
24-
DB_ARGS+=("--${param}")
28+
29+
ODOO_ARGS+=("--${param}")
30+
ODOO_ARGS+=("${value}")
31+
32+
DB_ARGS+=("${pg_flag}")
2533
DB_ARGS+=("${value}")
2634
}
2735

28-
check_config "db_name" "$NAME"
29-
check_config "db_host" "$HOST"
30-
check_config "db_port" "$PORT"
31-
check_config "db_user" "$USER"
32-
check_config "db_password" "$PASSWORD"
36+
check_config "db_name" "$NAME" "-d"
37+
check_config "db_host" "$HOST" "-h"
38+
check_config "db_port" "$PORT" "-p"
39+
check_config "db_user" "$USER" "-U"
40+
# check_config "db_password" "$PASSWORD"
3341

3442
case "$1" in
3543
-- | odoo)
3644
shift
3745
if [[ "$1" == "scaffold" ]] ; then
3846
exec odoo "$@"
3947
else
40-
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
41-
exec odoo "$@" "${DB_ARGS[@]}"
48+
pg_isready ${DB_ARGS[@]} --timeout=30
49+
exec odoo "$@" "${ODOO_ARGS[@]}"
4250
fi
4351
;;
4452
-*)
45-
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
46-
exec odoo "$@" "${DB_ARGS[@]}"
53+
pg_isready ${DB_ARGS[@]} --timeout=30
54+
exec odoo "$@" "${ODOO_ARGS[@]}"
4755
;;
4856
*)
4957
exec "$@"

17.0/wait-for-psql.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)