fixup! fixup! wip
This commit is contained in:
parent
06d5501c49
commit
954d83e6b6
|
|
@ -38,6 +38,8 @@ def generate_module_analysis(ctx, last_step, database, modules):
|
||||||
initial_step = migration_steps[0].copy()
|
initial_step = migration_steps[0].copy()
|
||||||
final_step = migration_steps[1].copy()
|
final_step = migration_steps[1].copy()
|
||||||
|
|
||||||
|
alternative_xml_rpc_port = ctx.obj["config"]["odoo_host_xmlrpc_port"] + 10
|
||||||
|
|
||||||
if not database:
|
if not database:
|
||||||
database = "%s__analysis__" % (
|
database = "%s__analysis__" % (
|
||||||
ctx.obj["config"]["project_name"].replace("-", "_"),
|
ctx.obj["config"]["project_name"].replace("-", "_"),
|
||||||
|
|
@ -52,32 +54,62 @@ def generate_module_analysis(ctx, last_step, database, modules):
|
||||||
str(final_step["release"]).replace(".", ""),
|
str(final_step["release"]).replace(".", ""),
|
||||||
)
|
)
|
||||||
|
|
||||||
if not modules:
|
modules = (modules or "").split(",")
|
||||||
modules = "base"
|
|
||||||
|
|
||||||
# Force to be in openupgrade mode
|
# Force to be in openupgrade mode
|
||||||
initial_step["action"] = final_step["action"] = "upgrade"
|
initial_step["action"] = final_step["action"] = "upgrade"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# INITIAL : Run odoo and install analysis module
|
||||||
run_odoo(
|
run_odoo(
|
||||||
ctx,
|
ctx,
|
||||||
initial_step,
|
initial_step,
|
||||||
database=initial_database,
|
database=initial_database,
|
||||||
detached_container=False,
|
detached_container=False,
|
||||||
stop_after_init=True,
|
stop_after_init=True,
|
||||||
init=modules + "," + get_upgrade_analysis_module(initial_step),
|
init=get_upgrade_analysis_module(initial_step),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# INITIAL : Run odoo for odoorpc
|
||||||
run_odoo(
|
run_odoo(
|
||||||
ctx,
|
ctx,
|
||||||
initial_step,
|
initial_step,
|
||||||
database=initial_database,
|
database=initial_database,
|
||||||
detached_container=True,
|
detached_container=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
initial_instance = OdooInstance(ctx, initial_database)
|
initial_instance = OdooInstance(ctx, initial_database)
|
||||||
|
|
||||||
|
# INITIAL : install modules to analyse and generate records
|
||||||
|
|
||||||
|
initial_instance.install_modules(modules)
|
||||||
generate_records(initial_instance, initial_step)
|
generate_records(initial_instance, initial_step)
|
||||||
|
|
||||||
|
# FINAL : Run odoo and install analysis module
|
||||||
|
run_odoo(
|
||||||
|
ctx,
|
||||||
|
final_step,
|
||||||
|
database=final_database,
|
||||||
|
detached_container=False,
|
||||||
|
stop_after_init=True,
|
||||||
|
init=get_upgrade_analysis_module(final_step),
|
||||||
|
alternative_xml_rpc_port=alternative_xml_rpc_port,
|
||||||
|
)
|
||||||
|
|
||||||
|
# FINAL : Run odoo for odoorpc and install modules to analyse
|
||||||
|
run_odoo(
|
||||||
|
ctx,
|
||||||
|
final_step,
|
||||||
|
database=final_database,
|
||||||
|
detached_container=True,
|
||||||
|
alternative_xml_rpc_port=alternative_xml_rpc_port,
|
||||||
|
)
|
||||||
|
final_instance = OdooInstance(ctx, final_database)
|
||||||
|
|
||||||
|
# FINAL : install modules to analyse and generate records
|
||||||
|
|
||||||
|
final_instance.install_modules(modules)
|
||||||
|
generate_records(final_instance, initial_step)
|
||||||
|
|
||||||
final_database = final_database
|
final_database = final_database
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
logger.info("Received Keyboard Interrupt or System Exiting...")
|
logger.info("Received Keyboard Interrupt or System Exiting...")
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ def get_server_wide_modules_upgrade(migration_step: dict) -> str:
|
||||||
|
|
||||||
|
|
||||||
def get_upgrade_analysis_module(migration_step: dict) -> str:
|
def get_upgrade_analysis_module(migration_step: dict) -> str:
|
||||||
""" return the upgrade_analysis module name"""
|
"""return the upgrade_analysis module name"""
|
||||||
|
|
||||||
if migration_step["release"] >= 14.0:
|
if migration_step["release"] >= 14.0:
|
||||||
# (Module in OCA/server-tools)
|
# (Module in OCA/server-tools)
|
||||||
|
|
|
||||||
|
|
@ -149,17 +149,17 @@ def run_odoo(
|
||||||
):
|
):
|
||||||
logger.info(
|
logger.info(
|
||||||
"Launching Odoo Container (Release {release}) for {db_text}"
|
"Launching Odoo Container (Release {release}) for {db_text}"
|
||||||
" in {action} mode. Demo Data is {demo_text}."
|
" in {action} mode. Demo Data is {demo_text}"
|
||||||
" {stop_text}. (Init : {init} ; Update : {update}".format(
|
" {stop_text} {init_text} {update_text}".format(
|
||||||
release=migration_step["release"],
|
release=migration_step["release"],
|
||||||
db_text=database and "database '%s'" % database or "any databases",
|
db_text=database and "database '%s'" % database or "any databases",
|
||||||
action=migration_step["action"] == "update"
|
action=migration_step["action"] == "update"
|
||||||
and "regular"
|
and "regular"
|
||||||
or "OpenUpgrade",
|
or "OpenUpgrade",
|
||||||
demo_text=demo and "enabled" or "disabled",
|
demo_text=demo and "enabled" or "disabled",
|
||||||
stop_text=stop_after_init and "(stop-after-init)" or "",
|
stop_text=stop_after_init and " (stop-after-init)" or "",
|
||||||
init=init,
|
init_text=init and " (Init : %s)" % init or "",
|
||||||
update=update,
|
update_text=update and " (Update : %s)" % update or "",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
odoo_version = get_odoo_version_from_migration_step(ctx, migration_step)
|
odoo_version = get_odoo_version_from_migration_step(ctx, migration_step)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@ class OdooInstance:
|
||||||
or ctx.obj["config"]["odoo_host_xmlrpc_port"]
|
or ctx.obj["config"]["odoo_host_xmlrpc_port"]
|
||||||
)
|
)
|
||||||
logger.info(
|
logger.info(
|
||||||
"Connect to Odoo instance via odoorpc (Port %s)... " % port
|
"Connect to Odoo database %s via odoorpc (Port %s)... "
|
||||||
|
% (database, port)
|
||||||
)
|
)
|
||||||
|
|
||||||
for x in range(1, _ODOO_RPC_MAX_TRY + 1):
|
for x in range(1, _ODOO_RPC_MAX_TRY + 1):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user