mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Relax the permission check on the directory containing the config database, as it may fail in some environments such as OpenShift. Fixes #4276
This commit is contained in:
@@ -25,3 +25,4 @@ Bug fixes
|
|||||||
| `Bug #4261 <https://redmine.postgresql.org/issues/4261>`_ - Stop using application/x-javascript as a mime type and use the RFC-compliant application/javascript instead.
|
| `Bug #4261 <https://redmine.postgresql.org/issues/4261>`_ - Stop using application/x-javascript as a mime type and use the RFC-compliant application/javascript instead.
|
||||||
| `Bug #4262 <https://redmine.postgresql.org/issues/4262>`_ - Fixed error on displaying table properties of a table partitioned by list having a default partition.
|
| `Bug #4262 <https://redmine.postgresql.org/issues/4262>`_ - Fixed error on displaying table properties of a table partitioned by list having a default partition.
|
||||||
| `Bug #4269 <https://redmine.postgresql.org/issues/4269>`_ - Fix navigation of switch cells in grids.
|
| `Bug #4269 <https://redmine.postgresql.org/issues/4269>`_ - Fix navigation of switch cells in grids.
|
||||||
|
| `Bug #4276 <https://redmine.postgresql.org/issues/4276>`_ - Relax the permission check on the directory containing the config database, as it may fail in some environments such as OpenShift.
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from flask import current_app
|
||||||
|
|
||||||
|
|
||||||
def _create_directory_if_not_exists(_path):
|
def _create_directory_if_not_exists(_path):
|
||||||
@@ -21,7 +22,15 @@ def create_app_data_directory(config):
|
|||||||
"""
|
"""
|
||||||
# Create the directory containing the configuration file (if not present).
|
# Create the directory containing the configuration file (if not present).
|
||||||
_create_directory_if_not_exists(os.path.dirname(config.SQLITE_PATH))
|
_create_directory_if_not_exists(os.path.dirname(config.SQLITE_PATH))
|
||||||
os.chmod(os.path.dirname(config.SQLITE_PATH), 0o700)
|
# 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
|
||||||
|
# OpenShift. We'll still secure the config database anyway.
|
||||||
|
try:
|
||||||
|
os.chmod(os.path.dirname(config.SQLITE_PATH), 0o700)
|
||||||
|
except Exception as e:
|
||||||
|
# The flask app isn't setup yet, so we can't use the logger
|
||||||
|
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))
|
||||||
|
|||||||
Reference in New Issue
Block a user