[IMP] add logger in execute_sql_file

This commit is contained in:
Sylvain LE GAL 2022-06-29 20:13:08 +02:00
parent f44ac7f7cd
commit 798e27ab16
2 changed files with 3 additions and 2 deletions

View File

@ -83,7 +83,7 @@ def execute_sql_file(ctx, database, sql_file):
container_path = Path("/env/") / relative_path
docker_command = (
"psql" " --username=odoo" " --dbname={database}" " --file {file_path}"
"psql --username=odoo --dbname={database} --file {file_path}"
).format(database=database, file_path=container_path)
logger.info(
"Executing the script '%s' in postgres container"
@ -91,6 +91,7 @@ def execute_sql_file(ctx, database, sql_file):
)
docker_result = container.exec_run(docker_command)
if docker_result.exit_code != 0:
logger.error(docker_result.output)
raise Exception(
"The script '%s' failed on database %s. Exit Code : %d"
% (relative_path, database, docker_result.exit_code)

View File

@ -7,7 +7,7 @@ env = env # noqa: F821
for i in range(0, 10):
partner_name = "Partner #%d" % (i)
_logger.info("Create Partner %s")
_logger.info("Create Partner %s" % partner_name)
env["res.partner"].create({"name": partner_name})
_logger.info("post-migration-custom_test.py : End of script.")