[FIX] allow to write on log folder inside containers
This commit is contained in:
parent
ce886eccfc
commit
51f248d1ab
|
|
@ -142,3 +142,6 @@ if you want to build an image for some given releases, you can provide an extra
|
||||||
```
|
```
|
||||||
odoo-openupgrade-wizard docker-build --releases 10.0,12.0
|
odoo-openupgrade-wizard docker-build --releases 10.0,12.0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## ``odoo-openupgrade-wizard run``
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,7 @@
|
||||||
- short_help of group decorator ? seems useless...
|
- short_help of group decorator ? seems useless...
|
||||||
|
|
||||||
* add constrains on ``--step`` option.
|
* add constrains on ``--step`` option.
|
||||||
|
|
||||||
|
|
||||||
|
* revert : set 777 to log and filestore to be able to write on this folder
|
||||||
|
inside the containers. TODO, ask to coop it easy or commown for better alternative.
|
||||||
|
|
|
||||||
|
|
@ -59,14 +59,13 @@ def main(ctx, env_folder, filestore_folder):
|
||||||
filestore_folder_path = Path(filestore_folder)
|
filestore_folder_path = Path(filestore_folder)
|
||||||
|
|
||||||
# ensure log folder exists
|
# ensure log folder exists
|
||||||
ensure_folder_exists(log_folder_path, git_ignore_content=True)
|
ensure_folder_exists(log_folder_path, mode="777", git_ignore_content=True)
|
||||||
|
|
||||||
# Create log file
|
# Create log file
|
||||||
log_file_path = log_folder_path / Path(
|
log_prefix = "{}__{}".format(
|
||||||
"{}__{}.log".format(
|
date_begin.strftime("%Y_%m_%d__%H_%M_%S"), ctx.invoked_subcommand
|
||||||
date_begin.strftime("%Y_%m_%d__%H_%M_%S"), ctx.invoked_subcommand
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
log_file_path = log_folder_path / Path(log_prefix + ".log")
|
||||||
logger.add(log_file_path)
|
logger.add(log_file_path)
|
||||||
|
|
||||||
config_file_path = env_folder_path / Path("config.yml")
|
config_file_path = env_folder_path / Path("config.yml")
|
||||||
|
|
@ -76,6 +75,7 @@ def main(ctx, env_folder, filestore_folder):
|
||||||
ctx.obj["src_folder_path"] = src_folder_path
|
ctx.obj["src_folder_path"] = src_folder_path
|
||||||
ctx.obj["script_folder_path"] = script_folder_path
|
ctx.obj["script_folder_path"] = script_folder_path
|
||||||
ctx.obj["log_folder_path"] = log_folder_path
|
ctx.obj["log_folder_path"] = log_folder_path
|
||||||
|
ctx.obj["log_prefix"] = log_prefix
|
||||||
ctx.obj["filestore_folder_path"] = filestore_folder_path
|
ctx.obj["filestore_folder_path"] = filestore_folder_path
|
||||||
|
|
||||||
ctx.obj["config_file_path"] = config_file_path
|
ctx.obj["config_file_path"] = config_file_path
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ def init(
|
||||||
|
|
||||||
# 4. ensure filestore folder exists
|
# 4. ensure filestore folder exists
|
||||||
ensure_folder_exists(
|
ensure_folder_exists(
|
||||||
ctx.obj["filestore_folder_path"], git_ignore_content=True
|
ctx.obj["filestore_folder_path"], mode="777", git_ignore_content=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# 5. ensure main configuration file exists
|
# 5. ensure main configuration file exists
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ def run(ctx, step, database, stop_after_init, init_modules):
|
||||||
stop_after_init=stop_after_init,
|
stop_after_init=stop_after_init,
|
||||||
)
|
)
|
||||||
if not stop_after_init:
|
if not stop_after_init:
|
||||||
|
# todo, WRITE A TEXT TO SAY : the service is available on
|
||||||
|
# http://localhost:xxxx
|
||||||
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):
|
||||||
logger.info("Received Keyboard Interrupt or System Exiting...")
|
logger.info("Received Keyboard Interrupt or System Exiting...")
|
||||||
|
|
|
||||||
|
|
@ -98,9 +98,6 @@ RUN apt-get update || true &&\
|
||||||
RUN {{ odoo_version["python_major_version"] }}\
|
RUN {{ odoo_version["python_major_version"] }}\
|
||||||
-m pip install -r python_requirements.txt
|
-m pip install -r python_requirements.txt
|
||||||
|
|
||||||
|
|
||||||
# VOLUME ["/var/lib/odoo2"]
|
|
||||||
|
|
||||||
# Reset to odoo user to run the container
|
# Reset to odoo user to run the container
|
||||||
USER odoo
|
USER odoo
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,9 @@ def generate_odoo_command(
|
||||||
stop_after_init_cmd = stop_after_init and "--stop-after-init" or ""
|
stop_after_init_cmd = stop_after_init and "--stop-after-init" or ""
|
||||||
shell_cmd = shell and "shell" or ""
|
shell_cmd = shell and "shell" or ""
|
||||||
demo_cmd = not demo and "--without-demo all" or ""
|
demo_cmd = not demo and "--without-demo all" or ""
|
||||||
# TODO, FIXME
|
log_file = "/env/log/{}____{}.log".format(
|
||||||
# log_file = "/env/log/%s" % "log.log"
|
ctx.obj["log_prefix"], migration_step["complete_name"]
|
||||||
|
)
|
||||||
result = (
|
result = (
|
||||||
f"/odoo_env/src/odoo/odoo-bin"
|
f"/odoo_env/src/odoo/odoo-bin"
|
||||||
f" --db_host db"
|
f" --db_host db"
|
||||||
|
|
@ -94,7 +95,7 @@ def generate_odoo_command(
|
||||||
f" --workers 0"
|
f" --workers 0"
|
||||||
f" --config /odoo_env/odoo.cfg"
|
f" --config /odoo_env/odoo.cfg"
|
||||||
# f" --data-dir /env/filestore/"
|
# f" --data-dir /env/filestore/"
|
||||||
# f" --logfile {log_file}"
|
f" --logfile {log_file}"
|
||||||
f" --addons-path {addons_path}"
|
f" --addons-path {addons_path}"
|
||||||
f" {database_cmd}"
|
f" {database_cmd}"
|
||||||
f" {update_cmd}"
|
f" {update_cmd}"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from . import cli_runner_invoke
|
from odoo_openupgrade_wizard.tools_docker import get_docker_client
|
||||||
|
|
||||||
# from odoo_openupgrade_wizard.tools_docker import get_docker_client
|
from . import cli_runner_invoke
|
||||||
|
|
||||||
|
|
||||||
def test_cli_run():
|
def test_cli_run():
|
||||||
|
|
@ -27,8 +27,8 @@ def test_cli_run():
|
||||||
|
|
||||||
# assert db_filestore_path.exists()
|
# assert db_filestore_path.exists()
|
||||||
|
|
||||||
# # Ensure that all the containers are removed
|
# Ensure that all the containers are removed
|
||||||
# docker_client = get_docker_client()
|
docker_client = get_docker_client()
|
||||||
# assert not docker_client.containers.list(
|
assert not docker_client.containers.list(
|
||||||
# all=True, filters={"name": "odoo-openupgrade-wizard"}
|
all=True, filters={"name": "odoo-openupgrade-wizard"}
|
||||||
# )
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user