parameterize db_name

This commit is contained in:
Mohammed Al Sahaf 2022-11-19 04:00:52 +03:00
parent 456817151a
commit f53ab3bb48
No known key found for this signature in database
3 changed files with 6 additions and 3 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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: