[IMP] use LOCAL_USER_ID calling odoo-bedrock, so no need to create filestore and log folder with 777

This commit is contained in:
Sylvain LE GAL 2022-06-28 16:55:08 +02:00
parent 4d3bb66e4e
commit b5419e5d19
4 changed files with 13 additions and 58 deletions

View File

@ -80,7 +80,7 @@ def main(ctx, env_folder, filestore_folder, log_level):
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, mode="777", git_ignore_content=True) ensure_folder_exists(log_folder_path, git_ignore_content=True)
# Create log file # Create log file
log_prefix = "{}__{}".format( log_prefix = "{}__{}".format(

View File

@ -111,7 +111,7 @@ def init(
# 4. ensure filestore folder exists # 4. ensure filestore folder exists
ensure_folder_exists( ensure_folder_exists(
ctx.obj["filestore_folder_path"], mode="777", git_ignore_content=True ctx.obj["filestore_folder_path"], git_ignore_content=True
) )
# 5. ensure postgres data folder exists # 5. ensure postgres data folder exists

View File

@ -20,7 +20,10 @@ from odoo_openupgrade_wizard.tools.tools_docker import (
run_container, run_container,
) )
from odoo_openupgrade_wizard.tools.tools_postgres import get_postgres_container from odoo_openupgrade_wizard.tools.tools_postgres import get_postgres_container
from odoo_openupgrade_wizard.tools.tools_system import get_script_folder from odoo_openupgrade_wizard.tools.tools_system import (
get_local_user_id,
get_script_folder,
)
def get_odoo_addons_path( def get_odoo_addons_path(
@ -112,61 +115,6 @@ def generate_odoo_command(
return result return result
# def generate_odoo_config_file(
# ctx, migration_step, log_file, execution_context
# ):
# """Create a config file name _auto_generated_odoo.cfg
# in the according environment (defined by migration_step)
# This configuration file is a merge of the odoo.cfg file that can
# contain custom values, and the values required to run the docker
# container.
# """
# odoo_env_path = get_odoo_env_path(ctx, migration_step["version"])
# custom_odoo_config_file = odoo_env_path / "odoo.cfg"
# auto_generated_odoo_config_file = (
# odoo_env_path / "_auto_generated_odoo.cfg"
# )
# parser = configparser.RawConfigParser()
# # Read custom file
# parser.read(custom_odoo_config_file)
# # compute addons_path
# addons_path = ",".join(
# [
# str(x)
# for x in get_odoo_addons_path(
# ctx, Path("/odoo_env"), migration_step, execution_context
# )
# ]
# )
# # compute server wides modules
# server_wide_modules = parser.get(
# "options", "server_wide_modules", fallback=[]
# )
# server_wide_modules += get_server_wide_modules_upgrade(migration_step)
# # Add required keys
# if "options" not in parser:
# parser.add_section("options")
# parser.set("options", "db_host", "db")
# parser.set("options", "db_port", 5432)
# parser.set("options", "db_user", "odoo")
# parser.set("options", "db_password", "odoo")
# parser.set("options", "workers", 0)
# parser.set("options", "data_dir", "/env/filestore/")
# parser.set("options", "logfile", log_file)
# parser.set("options", "addons_path", addons_path)
# if server_wide_modules:
# parser.set(
# "options", "server_wide_modules", ",".join(server_wide_modules)
# )
# parser.write(open(auto_generated_odoo_config_file, "w"))
def run_odoo( def run_odoo(
ctx, ctx,
migration_step: dict, migration_step: dict,
@ -279,7 +227,9 @@ def run_container_odoo(
"LOGFILE": log_file, "LOGFILE": log_file,
"ADDONS_PATH": addons_path, "ADDONS_PATH": addons_path,
"WORKERS": 0, "WORKERS": 0,
"LOCAL_USER_ID": get_local_user_id(),
} }
# TODO, handle custom config.cfg file
if server_wide_modules: if server_wide_modules:
environments["SERVER_WIDE_MODULES"] = ",".join(server_wide_modules) environments["SERVER_WIDE_MODULES"] = ",".join(server_wide_modules)

View File

@ -91,3 +91,8 @@ def git_aggregate(folder_path: Path, config_path: Path, jobs: int):
% config_path % config_path
) )
gitaggregate_cmd.run(args) gitaggregate_cmd.run(args)
def get_local_user_id():
# hum, could be improved, don't you think ?
return 1000