public inbox for [email protected]
help / color / mirror / Atom feedFrom: Yogesh Mahajan <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][Patch] RM6076 - No error thrown while importing server if servers.json has incorrect keys/insufficient keys
Date: Thu, 1 Apr 2021 17:42:56 +0530
Message-ID: <CAMa=N=PVnqXWX0ZimUXH3DwvH6=ndD90ypWWzcEFj-i4M0_3QA@mail.gmail.com> (raw)
Hello Team,
Please find an attached patch which shows the exact error if the json file
used to load the server has missing keys/incorrect key value.
Thanks,
Yogesh Mahajan
EnterpriseDB
Attachments:
[application/octet-stream] RM6076_v1.patch (1.2K, 3-RM6076_v1.patch)
download | inline diff:
diff --git a/web/setup.py b/web/setup.py
index 3f054fe03..828b68f11 100644
--- a/web/setup.py
+++ b/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")
-
- check_attrib("SSLMode")
- check_attrib("MaintenanceDB")
+ for attrib in ("Port", "Username"):
+ errmsg = check_attrib(attrib)
+ if errmsg:
+ return errmsg
+
+ 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:
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin][Patch] RM6076 - No error thrown while importing server if servers.json has incorrect keys/insufficient keys
In-Reply-To: <CAMa=N=PVnqXWX0ZimUXH3DwvH6=ndD90ypWWzcEFj-i4M0_3QA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox