Apply all suggestion made by Rémy Taymans.
This commit is contained in:
parent
a73de5f240
commit
f1cf0dac23
|
|
@ -41,14 +41,16 @@ def generate_module_analysis(ctx, step, database, modules):
|
|||
alternative_xml_rpc_port = ctx.obj["config"]["odoo_host_xmlrpc_port"] + 10
|
||||
|
||||
if not database:
|
||||
database = f"{ctx.obj['config']['project_name'].replace('-', '_')}"
|
||||
"__analysis__"
|
||||
database = (
|
||||
f"{ctx.obj['config']['project_name'].replace('-', '_')}"
|
||||
"__analysis__"
|
||||
)
|
||||
|
||||
initial_database = (
|
||||
f"{database}_" f"{str(initial_step['version']).replace('.', '')}"
|
||||
f"{database}_{str(initial_step['version']).replace('.', '')}"
|
||||
)
|
||||
final_database = (
|
||||
f"{database}_" f"{str(final_step['version']).replace('.', '')}"
|
||||
f"{database}_{str(final_step['version']).replace('.', '')}"
|
||||
)
|
||||
|
||||
modules = modules and modules.split(",") or []
|
||||
|
|
|
|||
|
|
@ -101,8 +101,7 @@ def init(
|
|||
"execution_context": "openupgrade",
|
||||
"version": odoo_version,
|
||||
"complete_name": (
|
||||
f"step_{str(step_nbr).rjust(2, '0')}"
|
||||
f"__openupgrade__{odoo_version}"
|
||||
f"step_{step_nbr:>02}__openupgrade__{odoo_version}"
|
||||
),
|
||||
}
|
||||
)
|
||||
|
|
@ -116,8 +115,7 @@ def init(
|
|||
"execution_context": "regular",
|
||||
"version": odoo_versions[-1],
|
||||
"complete_name": (
|
||||
f"step_{str(step_nbr).rjust(2, '0')}"
|
||||
f"__regular__{odoo_versions[-1]}"
|
||||
f"step_{step_nbr:>02}__regular__{odoo_versions[-1]}"
|
||||
),
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ def run_container(
|
|||
for k, v in ports.items():
|
||||
debug_docker_command += f" --publish {k}:{v}\\\n"
|
||||
for k, v in volumes.items():
|
||||
debug_docker_command += f" --volume {str(k)}:{str(v)}\\\n"
|
||||
debug_docker_command += f" --volume {k}:{v}\\\n"
|
||||
for k, v in environments.items():
|
||||
debug_docker_command += f" --env {k}={v}\\\n"
|
||||
for k, v in links.items():
|
||||
|
|
@ -67,7 +67,7 @@ def run_container(
|
|||
debug_docker_command += f" {image_name}"
|
||||
if command:
|
||||
debug_docker_command += f" \\\n{command}"
|
||||
logger.debug("DOCKER COMMAND:\n{debug_docker_command}")
|
||||
logger.debug(f"DOCKER COMMAND:\n{debug_docker_command}")
|
||||
|
||||
container = client.containers.run(
|
||||
image_name,
|
||||
|
|
@ -113,7 +113,7 @@ def kill_container(container_name):
|
|||
ignore_removed=True,
|
||||
)
|
||||
except docker.errors.NotFound as err:
|
||||
logger.debug(f"Cannot kill container {container_name}: {str(err)}")
|
||||
logger.debug(f"Cannot kill container {container_name}: {err}")
|
||||
containers = []
|
||||
|
||||
for container in containers:
|
||||
|
|
@ -125,9 +125,7 @@ def kill_container(container_name):
|
|||
try:
|
||||
container.stop()
|
||||
except docker.errors.NotFound as err:
|
||||
logger.debug(
|
||||
f"Cannot kill container {container.name}: {str(err)}"
|
||||
)
|
||||
logger.debug(f"Cannot kill container {container.name}: {err}")
|
||||
|
||||
# TODO, we should here filter by name
|
||||
# but filters={"name": container_name}
|
||||
|
|
|
|||
|
|
@ -107,13 +107,12 @@ class OdooInstance:
|
|||
sleeping_time = 2 * try_qty * 60
|
||||
logger.warning(
|
||||
f"Error. Retrying in {sleeping_time} seconds."
|
||||
f"\n {e}"
|
||||
f"\n{e}"
|
||||
)
|
||||
time.sleep(sleeping_time)
|
||||
else:
|
||||
logger.critical(
|
||||
f"Error after {try_qty} try. Exiting."
|
||||
f"\n {e}"
|
||||
f"Error after {try_qty} try. Exiting." f"\n{e}"
|
||||
)
|
||||
raise e
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class Analysis(object):
|
|||
).strip()
|
||||
elif len(splited_line) > 3:
|
||||
raise ValueError(
|
||||
f"Incorrect value in openupgrade analysis"
|
||||
"Incorrect value in openupgrade analysis"
|
||||
f" file {coverage_path} for line {line}"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ def execute_psql_command(
|
|||
f" {' '.join(psql_args)}"
|
||||
)
|
||||
logger.debug(
|
||||
"Executing the following command in postgres container\n" f"{command}"
|
||||
f"Executing the following command in postgres container\n{command}"
|
||||
)
|
||||
docker_result = exec_container(container, command)
|
||||
return docker_result.output.decode("utf-8")
|
||||
|
|
@ -193,7 +193,7 @@ def chown_to_local_user(ctx, filepath: os.PathLike):
|
|||
uid=user_uid, filepath=filepath
|
||||
)
|
||||
logger.debug(
|
||||
"Executing the following command in postgres container:\n" f"{command}"
|
||||
f"Executing the following command in postgres container:\n{command}"
|
||||
)
|
||||
chown_result = exec_container(container, command)
|
||||
return chown_result.output.decode("utf8")
|
||||
|
|
@ -229,7 +229,7 @@ def execute_pg_dump(
|
|||
pg_dump_args=pg_dump_args,
|
||||
)
|
||||
logger.debug(
|
||||
"Executing the following command in postgres container:\n" f"{command}"
|
||||
f"Executing the following command in postgres container:\n{command}"
|
||||
)
|
||||
pg_dump_result = exec_container(container, command)
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ def test_cli_run():
|
|||
)
|
||||
|
||||
# Ensure that a subfolder filestore/DB_NAME has been created
|
||||
db_filestore_path = Path(f"./filestore/filestore/{db_name}")
|
||||
db_filestore_path = Path("./filestore/filestore") / db_name
|
||||
assert db_filestore_path.exists()
|
||||
|
||||
# Ensure that 'base' module is installed
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user