Skip to content

Commit 8d86551

Browse files
committed
Improvements for psql wait script.
* support: Move to shared directory to avoid code drift. * feat: Make DB name configurable
1 parent 0daa6ed commit 8d86551

File tree

6 files changed

+5
-68
lines changed

6 files changed

+5
-68
lines changed

15.0/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ EXPOSE 8069 8071 8072
7979
# Set the default config file
8080
ENV ODOO_RC /etc/odoo/odoo.conf
8181

82-
COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py
82+
COPY ../shared/wait-for-psql.py /usr/local/bin/wait-for-psql.py
8383

8484
# Set default user when running the container
8585
USER odoo

16.0/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ EXPOSE 8069 8071 8072
9393
# Set the default config file
9494
ENV ODOO_RC /etc/odoo/odoo.conf
9595

96-
COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py
96+
COPY ../shared/wait-for-psql.py /usr/local/bin/wait-for-psql.py
9797

9898
# Set default user when running the container
9999
USER odoo

16.0/wait-for-psql.py

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

17.0/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ EXPOSE 8069 8071 8072
9595
# Set the default config file
9696
ENV ODOO_RC /etc/odoo/odoo.conf
9797

98-
COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py
98+
COPY ../shared/wait-for-psql.py /usr/local/bin/wait-for-psql.py
9999

100100
# Set default user when running the container
101101
USER odoo

17.0/wait-for-psql.py

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

15.0/wait-for-psql.py renamed to shared/wait-for-psql.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
arg_parser.add_argument('--db_host', required=True)
1111
arg_parser.add_argument('--db_port', required=True)
1212
arg_parser.add_argument('--db_user', required=True)
13+
arg_parser.add_argument('--db_name', required=True)
1314
arg_parser.add_argument('--db_password', required=True)
1415
arg_parser.add_argument('--timeout', type=int, default=5)
1516

@@ -18,7 +19,7 @@
1819
start_time = time.time()
1920
while (time.time() - start_time) < args.timeout:
2021
try:
21-
conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname='postgres')
22+
conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname=args.db_name)
2223
error = ''
2324
break
2425
except psycopg2.OperationalError as e:

0 commit comments

Comments
 (0)