mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
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:
committed by
Akshay Joshi
parent
c84df9cc0f
commit
53f5562468
19
web/setup.py
19
web/setup.py
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user