Don't try to set permissions on Windows. It won't work anyway. Fixes #4276
parent
155768a2d7
commit
ea4dbd31e8
|
|
@ -338,7 +338,8 @@ def create_app(app_name=None):
|
||||||
set_version(CURRENT_SCHEMA_VERSION)
|
set_version(CURRENT_SCHEMA_VERSION)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
os.chmod(config.SQLITE_PATH, 0o600)
|
if os.name != 'nt':
|
||||||
|
os.chmod(config.SQLITE_PATH, 0o600)
|
||||||
|
|
||||||
Mail(app)
|
Mail(app)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,19 +25,21 @@ def create_app_data_directory(config):
|
||||||
# Try to set the permissions on the direectory, but don't complain
|
# Try to set the permissions on the direectory, but don't complain
|
||||||
# if we can't. This may be the case on a mounted directory, e.g. in
|
# if we can't. This may be the case on a mounted directory, e.g. in
|
||||||
# OpenShift. We'll still secure the config database anyway.
|
# OpenShift. We'll still secure the config database anyway.
|
||||||
try:
|
if os.name != 'nt':
|
||||||
os.chmod(os.path.dirname(config.SQLITE_PATH), 0o700)
|
try:
|
||||||
except Exception as e:
|
os.chmod(os.path.dirname(config.SQLITE_PATH), 0o700)
|
||||||
# The flask app isn't setup yet, so we can't use the logger
|
except Exception as e:
|
||||||
print('WARNING: Failed to set ACL on the directory containing the '
|
# The flask app isn't setup yet, so we can't use the logger
|
||||||
'configuration database: {}'.format(e))
|
print('WARNING: Failed to set ACL on the directory containing the '
|
||||||
|
'configuration database: {}'.format(e))
|
||||||
|
|
||||||
# Create the directory containing the log file (if not present).
|
# Create the directory containing the log file (if not present).
|
||||||
_create_directory_if_not_exists(os.path.dirname(config.LOG_FILE))
|
_create_directory_if_not_exists(os.path.dirname(config.LOG_FILE))
|
||||||
|
|
||||||
# Create the session directory (if not present).
|
# Create the session directory (if not present).
|
||||||
_create_directory_if_not_exists(config.SESSION_DB_PATH)
|
_create_directory_if_not_exists(config.SESSION_DB_PATH)
|
||||||
os.chmod(os.path.dirname(config.SESSION_DB_PATH), 0o700)
|
if os.name != 'nt':
|
||||||
|
os.chmod(os.path.dirname(config.SESSION_DB_PATH), 0o700)
|
||||||
|
|
||||||
# Create the storage directory (if not present).
|
# Create the storage directory (if not present).
|
||||||
_create_directory_if_not_exists(config.STORAGE_DIR)
|
_create_directory_if_not_exists(config.STORAGE_DIR)
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,8 @@ def setup_db():
|
||||||
version.value = CURRENT_SCHEMA_VERSION
|
version.value = CURRENT_SCHEMA_VERSION
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
os.chmod(config.SQLITE_PATH, 0o600)
|
if os.name != 'nt':
|
||||||
|
os.chmod(config.SQLITE_PATH, 0o600)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue