[IMP] take into account Rémy remarks
This commit is contained in:
parent
ecd03ba392
commit
7df051acfa
|
|
@ -106,7 +106,6 @@ def main(ctx, env_folder, filestore_folder, log_level):
|
|||
with open(config_file_path) as file:
|
||||
config = yaml.safe_load(file)
|
||||
ctx.obj["config"] = config
|
||||
file.close()
|
||||
elif ctx.invoked_subcommand != "init":
|
||||
raise
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ def generate_module_analysis(ctx, step, database, modules):
|
|||
database=initial_database,
|
||||
detached_container=True,
|
||||
)
|
||||
# # INITIAL : install modules to analyse and generate records
|
||||
# INITIAL : install modules to analyse and generate records
|
||||
initial_instance = OdooInstance(ctx, initial_database)
|
||||
initial_modules = (
|
||||
modules
|
||||
|
|
@ -112,7 +112,7 @@ def generate_module_analysis(ctx, step, database, modules):
|
|||
links={initial_container.name: odoo_initial_host_name},
|
||||
)
|
||||
|
||||
# # FINAL : install modules to analyse and generate records
|
||||
# FINAL : install modules to analyse and generate records
|
||||
final_instance = OdooInstance(
|
||||
ctx,
|
||||
final_database,
|
||||
|
|
|
|||
|
|
@ -82,28 +82,28 @@ def init(
|
|||
]
|
||||
|
||||
# Add all upgrade steps
|
||||
count = 2
|
||||
step_nbr = 2
|
||||
for odoo_version in odoo_versions[1:]:
|
||||
steps.append(
|
||||
{
|
||||
"name": count,
|
||||
"name": step_nbr,
|
||||
"action": "upgrade",
|
||||
"release": odoo_version["release"],
|
||||
"complete_name": "step_%s__upgrade__%s"
|
||||
% (str(count).rjust(2, "0"), odoo_version["release"]),
|
||||
% (str(step_nbr).rjust(2, "0"), odoo_version["release"]),
|
||||
}
|
||||
)
|
||||
count += 1
|
||||
step_nbr += 1
|
||||
|
||||
# add final update step
|
||||
if len(odoo_versions) > 1:
|
||||
steps.append(
|
||||
{
|
||||
"name": count,
|
||||
"name": step_nbr,
|
||||
"action": "update",
|
||||
"release": odoo_versions[-1]["release"],
|
||||
"complete_name": "step_%s__update__%s"
|
||||
% (str(count).rjust(2, "0"), odoo_versions[-1]["release"]),
|
||||
% (str(step_nbr).rjust(2, "0"), odoo_versions[-1]["release"]),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -82,8 +82,9 @@ def get_migration_step_from_options(ctx, step_arg):
|
|||
for migration_step in ctx.obj["config"]["migration_steps"]:
|
||||
if migration_step["name"] == step:
|
||||
return migration_step
|
||||
# TODO, improve exception
|
||||
raise Exception
|
||||
raise ValueError(
|
||||
"No migration step found in configuration for step %s" % step_arg
|
||||
)
|
||||
|
||||
|
||||
def get_migration_steps_from_options(ctx, first_step_arg, last_step_arg):
|
||||
|
|
@ -99,7 +100,11 @@ def get_migration_steps_from_options(ctx, first_step_arg, last_step_arg):
|
|||
for migration_step in ctx.obj["config"]["migration_steps"]:
|
||||
if migration_step["name"] in list(range(first_step, last_step + 1)):
|
||||
result.append(migration_step.copy())
|
||||
if not result:
|
||||
# TODO, improve exception
|
||||
raise Exception
|
||||
return result
|
||||
if result:
|
||||
return result
|
||||
|
||||
raise ValueError(
|
||||
"Unable to define steps in configuration"
|
||||
" from options. (first step %s ; last step %s)"
|
||||
% (first_step_arg, last_step_arg)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -112,8 +112,10 @@ def get_base_module_folder(migration_step: dict) -> str:
|
|||
|
||||
|
||||
def skip_addon_path(migration_step: dict, path: Path) -> bool:
|
||||
# if repo.yml contains both odoo and openupgrade repo
|
||||
# we skip one of them (before the refactoring)
|
||||
"""return a boolean to indicate if the addon_path should be
|
||||
remove (during the generation of the addons_path).
|
||||
Note : if repo.yml contains both odoo and openupgrade repo
|
||||
we skip one of them (before the V14 refactoring)"""
|
||||
return (
|
||||
str(path).endswith("/src/odoo")
|
||||
or str(path).endswith("src/openupgrade")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user