From 492d8ce4d024e11c9aa715d4a4b7f99493eaef4b Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Sat, 28 Jan 2017 00:52:56 +0100 Subject: [PATCH] [FIX] config: correctly bootstrap data_dir Complements the patch in 15583a48134db69ebd9d93f955c3b4d6692e4b99 in order to properly bootstrap a writeable data_dir when it is (partially) nonexistant. Depending on the startup parameters the data_dir might otherwise have ended up read-only, preventing the creation of its necessary components (session store, file store). Only the `addons` directory of the data_dir needs to be read-only by default. --- openerp/tools/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openerp/tools/config.py b/openerp/tools/config.py index 8e30845063f..15ae40a1dce 100644 --- a/openerp/tools/config.py +++ b/openerp/tools/config.py @@ -684,9 +684,13 @@ class configmanager(object): @property def addons_data_dir(self): - d = os.path.join(self['data_dir'], 'addons', release.series) + add_dir = os.path.join(self['data_dir'], 'addons') + d = os.path.join(add_dir, release.series) if not os.path.exists(d): try: + # bootstrap parent dir +rwx + if not os.path.exists(add_dir): + os.makedirs(add_dir, 0700) # try to make +rx placeholder dir, will need manual +w to activate it os.makedirs(d, 0500) except OSError: