-
Notifications
You must be signed in to change notification settings - Fork 0
1.3 Step | SetupLogDir
Creates the directory for the Odoo log file, only if
ODOO_LOGFILEis configured. Reversible. It lives insrc/steps/setup_log_dir.rs. A port ofsetup_log_dirfromlib/system.sh.It runs after 1.2 CreateOdooUser, so the
odoouser already exists and the log directory can be chowned to it.
By design Odoo logs to journal/stdout through systemd, so ODOO_LOGFILE is empty and there is no
directory to create. In that case the step is entirely Untracked: snapshot, run and undo are
clean no-ops. No surprises, no artifacts.
The log file is resolved through the configuration cascade (.env key ODOO_LOGFILE, flag
--logfile) and reaches the step as ctx.odoo_logfile: Option<PathBuf>.
| Phase | Behaviour |
|---|---|
| snapshot | does the log file's parent directory already exist? → Preexisting/Untracked
|
| run |
Preexisting → skip (not ours); absent → mkdir + chown odoo:odoo + chmod 0750, then CreatedByUs. dry_run → log only |
| undo |
CreatedByUs and the directory is empty → rmdir. Non-empty (logs already written) → warning, no removal. Preexisting → no-op |
-
Never delete logs that were already written. If the directory holds files,
undodoes not remove it (best-effort, norm -rf) — those logs may be needed for the post-mortem. - A
Preexistingdirectory is never removed: it is not ours. - Idempotent and best-effort, like every undo.
Like 1.2 CreateOdooUser, it goes through the testable SystemOps
boundary (mkdir/chown/chmod/rmdir): the tests verify creation and removal without root and
without touching the real filesystem.
- The step is almost always a no-op (the log file is disabled by default): all its complexity sits
in the optional branch, handled with the same three
PreStates as every other step. - Guaranteed ordering: it runs after
CreateOdooUser, so thechown odoo:odoohas a valid user to point at. - Tests: disabled (total no-op),
CreatedByUs(creates and removes),Preexisting(untouched), non-empty directory (the undo does not remove).
Start here
Key concepts
References
For developers
Technical detail — how it works inside
Steps:
- 1.1 PrepareOptRoot
- 1.2 CreateOdooUser
- 1.3 SetupLogDir
- 1.3b SetupCacheDir
- 1.4 AptPackages (delta)
- 1.5 InstallWkhtmltopdf
- 1.6 SetupPostgres
- 1.7 CreateDbRole
- 1.8 CreateDatabase
- 1.9 CloneOdooRepo
- 1.10 CreateVirtualenv
- 1.11 InstallPythonRequirements
- 1.12 GenerateConfig
- 1.12b SetupDataDir
- 1.13 InitializeOdooDatabase
- 1.14 SetupSystemd
- 1.15 Nginx (6 sub-steps)
- 1.16 WriteControlScript + PatchBashrc
Cross-cutting: