Fixed an issue where correct error not thrown while importing servers and JSON file has incorrect/insufficient keys. Fixes #6076

This commit is contained in:
Yogesh Mahajan 2021-04-02 08:58:43 +05:30 committed by Akshay Joshi
parent c84df9cc0f
commit 53f5562468
2 changed files with 14 additions and 6 deletions

View File

@ -19,6 +19,7 @@ Bug fixes
*********
| `Issue #5519 <https://redmine.postgresql.org/issues/5519>`_ - Ensure that the query tool tab should be closed after server disconnection when auto-commit/auto-rollback is set to false.
| `Issue #6076 <https://redmine.postgresql.org/issues/6076>`_ - Fixed an issue where correct error not thrown while importing servers and JSON file has incorrect/insufficient keys.
| `Issue #6293 <https://redmine.postgresql.org/issues/6293>`_ - Fixed an issue where the procedure creation is failed when providing the Volatility option.
| `Issue #6327 <https://redmine.postgresql.org/issues/6327>`_ - Ensure that while comparing domains check function dependencies should be considered in schema diff.
| `Issue #6344 <https://redmine.postgresql.org/issues/6344>`_ - Fixed cannot unpack non-iterable response object error when selecting any partition.

View File

@ -181,18 +181,25 @@ def _validate_servers_data(data, is_admin):
if attrib not in obj:
return ("'%s' attribute not found for server '%s'" %
(attrib, server))
return None
check_attrib("Name")
check_attrib("Group")
for attrib in ("Group", "Name"):
errmsg = check_attrib(attrib)
if errmsg:
return errmsg
is_service_attrib_available = obj.get("Service", None) is not None
if not is_service_attrib_available:
check_attrib("Port")
check_attrib("Username")
for attrib in ("Port", "Username"):
errmsg = check_attrib(attrib)
if errmsg:
return errmsg
check_attrib("SSLMode")
check_attrib("MaintenanceDB")
for attrib in ("SSLMode", "MaintenanceDB"):
errmsg = check_attrib(attrib)
if errmsg:
return errmsg
if "Host" not in obj and "HostAddr" not in obj and not \
is_service_attrib_available: