[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:
|
with open(config_file_path) as file:
|
||||||
config = yaml.safe_load(file)
|
config = yaml.safe_load(file)
|
||||||
ctx.obj["config"] = config
|
ctx.obj["config"] = config
|
||||||
file.close()
|
|
||||||
elif ctx.invoked_subcommand != "init":
|
elif ctx.invoked_subcommand != "init":
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ def generate_module_analysis(ctx, step, database, modules):
|
||||||
database=initial_database,
|
database=initial_database,
|
||||||
detached_container=True,
|
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_instance = OdooInstance(ctx, initial_database)
|
||||||
initial_modules = (
|
initial_modules = (
|
||||||
modules
|
modules
|
||||||
|
|
@ -112,7 +112,7 @@ def generate_module_analysis(ctx, step, database, modules):
|
||||||
links={initial_container.name: odoo_initial_host_name},
|
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(
|
final_instance = OdooInstance(
|
||||||
ctx,
|
ctx,
|
||||||
final_database,
|
final_database,
|
||||||
|
|
|
||||||
|
|
@ -82,28 +82,28 @@ def init(
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add all upgrade steps
|
# Add all upgrade steps
|
||||||
count = 2
|
step_nbr = 2
|
||||||
for odoo_version in odoo_versions[1:]:
|
for odoo_version in odoo_versions[1:]:
|
||||||
steps.append(
|
steps.append(
|
||||||
{
|
{
|
||||||
"name": count,
|
"name": step_nbr,
|
||||||
"action": "upgrade",
|
"action": "upgrade",
|
||||||
"release": odoo_version["release"],
|
"release": odoo_version["release"],
|
||||||
"complete_name": "step_%s__upgrade__%s"
|
"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
|
# add final update step
|
||||||
if len(odoo_versions) > 1:
|
if len(odoo_versions) > 1:
|
||||||
steps.append(
|
steps.append(
|
||||||
{
|
{
|
||||||
"name": count,
|
"name": step_nbr,
|
||||||
"action": "update",
|
"action": "update",
|
||||||
"release": odoo_versions[-1]["release"],
|
"release": odoo_versions[-1]["release"],
|
||||||
"complete_name": "step_%s__update__%s"
|
"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"]:
|
for migration_step in ctx.obj["config"]["migration_steps"]:
|
||||||
if migration_step["name"] == step:
|
if migration_step["name"] == step:
|
||||||
return migration_step
|
return migration_step
|
||||||
# TODO, improve exception
|
raise ValueError(
|
||||||
raise Exception
|
"No migration step found in configuration for step %s" % step_arg
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_migration_steps_from_options(ctx, first_step_arg, last_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"]:
|
for migration_step in ctx.obj["config"]["migration_steps"]:
|
||||||
if migration_step["name"] in list(range(first_step, last_step + 1)):
|
if migration_step["name"] in list(range(first_step, last_step + 1)):
|
||||||
result.append(migration_step.copy())
|
result.append(migration_step.copy())
|
||||||
if not result:
|
if result:
|
||||||
# TODO, improve exception
|
|
||||||
raise Exception
|
|
||||||
return 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:
|
def skip_addon_path(migration_step: dict, path: Path) -> bool:
|
||||||
# if repo.yml contains both odoo and openupgrade repo
|
"""return a boolean to indicate if the addon_path should be
|
||||||
# we skip one of them (before the refactoring)
|
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 (
|
return (
|
||||||
str(path).endswith("/src/odoo")
|
str(path).endswith("/src/odoo")
|
||||||
or str(path).endswith("src/openupgrade")
|
or str(path).endswith("src/openupgrade")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user