mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-24 09:40:21 -06:00
Fixed an issue where pgAdmin failed to start due to bin path migration. Fixes #7557
This commit is contained in:
parent
01a9a41bd9
commit
985546fff6
@ -29,6 +29,7 @@ Housekeeping
|
||||
Bug fixes
|
||||
*********
|
||||
|
||||
| `Issue #7557 <https://redmine.postgresql.org/issues/7557>`_ - Fixed an issue where pgAdmin failed to start due to bin path migration.
|
||||
| `Issue #7580 <https://redmine.postgresql.org/issues/7580>`_ - Fixed an issue where backup does not work due to parameter 'preexec_fn' no longer being supported.
|
||||
| `Issue #7607 <https://redmine.postgresql.org/issues/7607>`_ - Ensure that the browser tree should be refreshed after changing the ownership.
|
||||
| `Issue #7644 <https://redmine.postgresql.org/issues/7644>`_ - Ensure that the dump servers functionality works from setup.py.
|
||||
|
@ -62,6 +62,36 @@ class ServerType(object):
|
||||
paths = Preferences('paths', _('Paths'))
|
||||
bin_paths = copy.deepcopy(BINARY_PATHS)
|
||||
|
||||
def path_converter(old_path):
|
||||
"""
|
||||
This function is used to convert old path to the
|
||||
new paths which are in JSON format.
|
||||
"""
|
||||
bin_paths_server_based = \
|
||||
copy.deepcopy(BINARY_PATHS['pg_bin_paths'])
|
||||
if key == 'ppas':
|
||||
bin_paths_server_based = \
|
||||
copy.deepcopy(BINARY_PATHS['as_bin_paths'])
|
||||
|
||||
if not ServerType.is_binary_path_of_type_json(old_path):
|
||||
set_binary_path(old_path, bin_paths_server_based,
|
||||
key, set_as_default=True)
|
||||
else:
|
||||
bin_path_dict = \
|
||||
{item['version']: item for item in bin_paths_server_based}
|
||||
old_path_dict = \
|
||||
{item['version']: item for item in json.loads(old_path)}
|
||||
|
||||
for item in bin_path_dict:
|
||||
bin_path_dict[item].update(old_path_dict.get(item, {}))
|
||||
|
||||
bin_paths_server_based = list(bin_path_dict.values())
|
||||
|
||||
# Set the DEFAULT_BINARY_PATHS if any
|
||||
ServerType.set_default_binary_path(bin_paths_server_based, key)
|
||||
|
||||
return json.dumps(bin_paths_server_based)
|
||||
|
||||
for key in cls.registry:
|
||||
st = cls.registry[key]
|
||||
|
||||
@ -91,35 +121,6 @@ class ServerType(object):
|
||||
category_label=_('Binary paths')
|
||||
)
|
||||
|
||||
def path_converter(old_path):
|
||||
"""
|
||||
This function is used to convert old path to the
|
||||
new paths which are in JSON format.
|
||||
"""
|
||||
bin_paths_server_based = \
|
||||
copy.deepcopy(BINARY_PATHS['pg_bin_paths'])
|
||||
if key == 'ppas':
|
||||
bin_paths_server_based = \
|
||||
copy.deepcopy(BINARY_PATHS['as_bin_paths'])
|
||||
|
||||
bin_path_dict = \
|
||||
{item['version']: item for item in bin_paths_server_based}
|
||||
old_path_dict = \
|
||||
{item['version']: item for item in json.loads(old_path)}
|
||||
|
||||
for item in bin_path_dict:
|
||||
bin_path_dict[item].update(old_path_dict.get(item, {}))
|
||||
|
||||
bin_paths_server_based = list(bin_path_dict.values())
|
||||
if not ServerType.is_binary_path_of_type_json(old_path):
|
||||
set_binary_path(old_path, bin_paths_server_based,
|
||||
key, set_as_default=True)
|
||||
|
||||
# Set the DEFAULT_BINARY_PATHS if any
|
||||
ServerType.set_default_binary_path(bin_paths_server_based, key)
|
||||
|
||||
return json.dumps(bin_paths_server_based)
|
||||
|
||||
# Run the migrate user preferences.
|
||||
paths.migrate_user_preferences(st.utility_path.pid,
|
||||
path_converter)
|
||||
|
Loading…
Reference in New Issue
Block a user