fixup! wip
This commit is contained in:
parent
e5813612ca
commit
06d5501c49
|
|
@ -7,7 +7,6 @@ from odoo_openupgrade_wizard.cli_options import (
|
||||||
step_option,
|
step_option,
|
||||||
)
|
)
|
||||||
from odoo_openupgrade_wizard.tools_odoo import kill_odoo, run_odoo
|
from odoo_openupgrade_wizard.tools_odoo import kill_odoo, run_odoo
|
||||||
from odoo_openupgrade_wizard.tools_odoo_instance import get_odoo_url
|
|
||||||
from odoo_openupgrade_wizard.tools_postgres import ensure_database
|
from odoo_openupgrade_wizard.tools_postgres import ensure_database
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -43,7 +42,9 @@ def run(ctx, step, database, stop_after_init, init_modules):
|
||||||
)
|
)
|
||||||
if not stop_after_init:
|
if not stop_after_init:
|
||||||
logger.info(
|
logger.info(
|
||||||
"Odoo is available on your host at %s" % get_odoo_url(ctx)
|
"Odoo is available on your host at"
|
||||||
|
" http://localhost:%s"
|
||||||
|
% ctx.obj["config"]["odoo_host_xmlrpc_port"]
|
||||||
)
|
)
|
||||||
input("Press 'Enter' to kill the odoo container and exit ...")
|
input("Press 'Enter' to kill the odoo container and exit ...")
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,7 @@ def run_odoo(
|
||||||
stop_after_init: bool = False,
|
stop_after_init: bool = False,
|
||||||
shell: bool = False,
|
shell: bool = False,
|
||||||
demo: bool = False,
|
demo: bool = False,
|
||||||
|
alternative_xml_rpc_port: int = False,
|
||||||
):
|
):
|
||||||
logger.info(
|
logger.info(
|
||||||
"Launching Odoo Container (Release {release}) for {db_text}"
|
"Launching Odoo Container (Release {release}) for {db_text}"
|
||||||
|
|
@ -181,8 +182,9 @@ def run_odoo(
|
||||||
get_docker_container_name(ctx, migration_step),
|
get_docker_container_name(ctx, migration_step),
|
||||||
command=command,
|
command=command,
|
||||||
ports={
|
ports={
|
||||||
"8069": ctx.obj["config"]["odoo_host_xmlrpc_port"],
|
"8069": alternative_xml_rpc_port
|
||||||
# "5432": ctx.obj["config"]["postgres_host_port"],
|
and alternative_xml_rpc_port
|
||||||
|
or ctx.obj["config"]["odoo_host_xmlrpc_port"],
|
||||||
},
|
},
|
||||||
volumes=[
|
volumes=[
|
||||||
"%s:/env/" % (env_path),
|
"%s:/env/" % (env_path),
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,6 @@ import time
|
||||||
import odoorpc
|
import odoorpc
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
|
||||||
def get_odoo_url(ctx) -> str:
|
|
||||||
return "http://0.0.0.0:%d" % (ctx.obj["config"]["odoo_host_xmlrpc_port"])
|
|
||||||
|
|
||||||
|
|
||||||
_ODOO_RPC_MAX_TRY = 60
|
_ODOO_RPC_MAX_TRY = 60
|
||||||
_ODOO_RPC_TIMEOUT = 60
|
_ODOO_RPC_TIMEOUT = 60
|
||||||
|
|
||||||
|
|
@ -18,12 +13,16 @@ class OdooInstance:
|
||||||
env = False
|
env = False
|
||||||
version = False
|
version = False
|
||||||
|
|
||||||
def __init__(self, ctx, database):
|
def __init__(self, ctx, database, alternative_xml_rpc_port=False):
|
||||||
# # TODO, improve me waith for response on http://localhost:port
|
# # TODO, improve me waith for response on http://localhost:port
|
||||||
# # with a time out
|
# # with a time out
|
||||||
# # the docker container take a little time to be up.
|
# # the docker container take a little time to be up.
|
||||||
# time.sleep(60)
|
# time.sleep(60)
|
||||||
port = ctx.obj["config"]["odoo_host_xmlrpc_port"]
|
port = (
|
||||||
|
alternative_xml_rpc_port
|
||||||
|
and alternative_xml_rpc_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 instance via odoorpc (Port %s)... " % port
|
||||||
)
|
)
|
||||||
|
|
@ -62,9 +61,10 @@ class OdooInstance:
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(
|
logger.error(
|
||||||
"Unable to connect to %s with login %s and password %s"
|
"Unable to connect to http://localhost:%s"
|
||||||
|
" with login %s and password %s"
|
||||||
% (
|
% (
|
||||||
get_odoo_url(ctx),
|
port,
|
||||||
"admin",
|
"admin",
|
||||||
"admin",
|
"admin",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user