parameterize db_name
This commit is contained in:
parent
456817151a
commit
f53ab3bb48
@ -7,6 +7,7 @@ import time
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
arg_parser = argparse.ArgumentParser()
|
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_host', required=True)
|
||||||
arg_parser.add_argument('--db_port', required=True)
|
arg_parser.add_argument('--db_port', required=True)
|
||||||
arg_parser.add_argument('--db_user', required=True)
|
arg_parser.add_argument('--db_user', required=True)
|
||||||
@ -18,7 +19,7 @@ if __name__ == '__main__':
|
|||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
while (time.time() - start_time) < args.timeout:
|
while (time.time() - start_time) < args.timeout:
|
||||||
try:
|
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 = ''
|
error = ''
|
||||||
break
|
break
|
||||||
except psycopg2.OperationalError as e:
|
except psycopg2.OperationalError as e:
|
||||||
|
@ -7,6 +7,7 @@ import time
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
arg_parser = argparse.ArgumentParser()
|
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_host', required=True)
|
||||||
arg_parser.add_argument('--db_port', required=True)
|
arg_parser.add_argument('--db_port', required=True)
|
||||||
arg_parser.add_argument('--db_user', required=True)
|
arg_parser.add_argument('--db_user', required=True)
|
||||||
@ -18,7 +19,7 @@ if __name__ == '__main__':
|
|||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
while (time.time() - start_time) < args.timeout:
|
while (time.time() - start_time) < args.timeout:
|
||||||
try:
|
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 = ''
|
error = ''
|
||||||
break
|
break
|
||||||
except psycopg2.OperationalError as e:
|
except psycopg2.OperationalError as e:
|
||||||
|
@ -7,6 +7,7 @@ import time
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
arg_parser = argparse.ArgumentParser()
|
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_host', required=True)
|
||||||
arg_parser.add_argument('--db_port', required=True)
|
arg_parser.add_argument('--db_port', required=True)
|
||||||
arg_parser.add_argument('--db_user', required=True)
|
arg_parser.add_argument('--db_user', required=True)
|
||||||
@ -18,7 +19,7 @@ if __name__ == '__main__':
|
|||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
while (time.time() - start_time) < args.timeout:
|
while (time.time() - start_time) < args.timeout:
|
||||||
try:
|
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 = ''
|
error = ''
|
||||||
break
|
break
|
||||||
except psycopg2.OperationalError as e:
|
except psycopg2.OperationalError as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user