From f53ab3bb48ed44fd49ea9285e170c0f9c373ab32 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Sat, 19 Nov 2022 04:00:52 +0300 Subject: [PATCH] parameterize db_name --- 14.0/wait-for-psql.py | 3 ++- 15.0/wait-for-psql.py | 3 ++- 16.0/wait-for-psql.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/14.0/wait-for-psql.py b/14.0/wait-for-psql.py index a55f440..aadcfca 100755 --- a/14.0/wait-for-psql.py +++ b/14.0/wait-for-psql.py @@ -7,6 +7,7 @@ import time if __name__ == '__main__': arg_parser = argparse.ArgumentParser() + arg_parser.add_argument('--db_name', required=True, default='postgres') arg_parser.add_argument('--db_host', required=True) arg_parser.add_argument('--db_port', required=True) arg_parser.add_argument('--db_user', required=True) @@ -18,7 +19,7 @@ if __name__ == '__main__': start_time = time.time() while (time.time() - start_time) < args.timeout: try: - conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname='postgres') + conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname=args.db_name) error = '' break except psycopg2.OperationalError as e: diff --git a/15.0/wait-for-psql.py b/15.0/wait-for-psql.py index a55f440..aadcfca 100755 --- a/15.0/wait-for-psql.py +++ b/15.0/wait-for-psql.py @@ -7,6 +7,7 @@ import time if __name__ == '__main__': arg_parser = argparse.ArgumentParser() + arg_parser.add_argument('--db_name', required=True, default='postgres') arg_parser.add_argument('--db_host', required=True) arg_parser.add_argument('--db_port', required=True) arg_parser.add_argument('--db_user', required=True) @@ -18,7 +19,7 @@ if __name__ == '__main__': start_time = time.time() while (time.time() - start_time) < args.timeout: try: - conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname='postgres') + conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname=args.db_name) error = '' break except psycopg2.OperationalError as e: diff --git a/16.0/wait-for-psql.py b/16.0/wait-for-psql.py index a55f440..aadcfca 100755 --- a/16.0/wait-for-psql.py +++ b/16.0/wait-for-psql.py @@ -7,6 +7,7 @@ import time if __name__ == '__main__': arg_parser = argparse.ArgumentParser() + arg_parser.add_argument('--db_name', required=True, default='postgres') arg_parser.add_argument('--db_host', required=True) arg_parser.add_argument('--db_port', required=True) arg_parser.add_argument('--db_user', required=True) @@ -18,7 +19,7 @@ if __name__ == '__main__': start_time = time.time() while (time.time() - start_time) < args.timeout: try: - conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname='postgres') + conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname=args.db_name) error = '' break except psycopg2.OperationalError as e: