[FIX] config: correctly bootstrap data_dir

Complements the patch in 15583a4813
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.
This commit is contained in:
Olivier Dony 2017-01-28 00:52:56 +01:00
parent f431cee99a
commit 492d8ce4d0
No known key found for this signature in database
GPG Key ID: CD556E25E8A6D0D4
1 changed files with 5 additions and 1 deletions

View File

@ -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: