diff --git a/docs/en_US/release_notes_6_14.rst b/docs/en_US/release_notes_6_14.rst index b687df06b..a03daff7b 100644 --- a/docs/en_US/release_notes_6_14.rst +++ b/docs/en_US/release_notes_6_14.rst @@ -29,6 +29,7 @@ Housekeeping Bug fixes ********* + | `Issue #7557 `_ - Fixed an issue where pgAdmin failed to start due to bin path migration. | `Issue #7580 `_ - Fixed an issue where backup does not work due to parameter 'preexec_fn' no longer being supported. | `Issue #7607 `_ - Ensure that the browser tree should be refreshed after changing the ownership. | `Issue #7644 `_ - Ensure that the dump servers functionality works from setup.py. diff --git a/web/pgadmin/browser/server_groups/servers/types.py b/web/pgadmin/browser/server_groups/servers/types.py index 1897509a9..83b8e5ec3 100644 --- a/web/pgadmin/browser/server_groups/servers/types.py +++ b/web/pgadmin/browser/server_groups/servers/types.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)