public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin][Patch] RM6076 - No error thrown while importing server if servers.json has incorrect keys/insufficient keys
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin][Patch] RM6076 - No error thrown while importing server if servers.json has incorrect keys/insufficient keys
@ 2021-04-01 12:12 Yogesh Mahajan <[email protected]>
2021-04-02 03:29 ` Re: [pgAdmin][Patch] RM6076 - No error thrown while importing server if servers.json has incorrect keys/insufficient keys Akshay Joshi <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Yogesh Mahajan @ 2021-04-01 12:12 UTC (permalink / raw)
To: pgadmin-hackers
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:
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin][Patch] RM6076 - No error thrown while importing server if servers.json has incorrect keys/insufficient keys
2021-04-01 12:12 [pgAdmin][Patch] RM6076 - No error thrown while importing server if servers.json has incorrect keys/insufficient keys Yogesh Mahajan <[email protected]>
@ 2021-04-02 03:29 ` Akshay Joshi <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Akshay Joshi @ 2021-04-02 03:29 UTC (permalink / raw)
To: Yogesh Mahajan <[email protected]>; +Cc: pgadmin-hackers
Thanks, patch applied.
On Thu, Apr 1, 2021 at 5:43 PM Yogesh Mahajan <
[email protected]> wrote:
> 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
>
--
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2021-04-02 03:29 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01 12:12 [pgAdmin][Patch] RM6076 - No error thrown while importing server if servers.json has incorrect keys/insufficient keys Yogesh Mahajan <[email protected]>
2021-04-02 03:29 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox