public inbox for [email protected]  
help / color / mirror / Atom feed
[pgadmin4][Patch]: Fixed minor issue in auto discover server when entry is blank in the config file
2+ messages / 2 participants
[nested] [flat]

* [pgadmin4][Patch]: Fixed minor issue in auto discover server when entry is blank in the config file
@ 2018-06-21 07:32 Akshay Joshi <[email protected]>
  2018-06-21 20:35 ` Re: [pgadmin4][Patch]: Fixed minor issue in auto discover server when entry is blank in the config file Dave Page <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Akshay Joshi @ 2018-06-21 07:32 UTC (permalink / raw)
  To: pgadmin-hackers

Hi Hackers,

I have found one minor issue in auto discovery logic. *getint* function of
ConfigParser throws exception if the value of the parameter is blank in the
config file. Example: *Port=*

Because of that exception pgAdmin4 unable to discover all the valid
servers. Attached is the patch to fix that. Please review it.

-- 
*Akshay Joshi*

*Sr. Software Architect *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


Attachments:

  [application/octet-stream] Auto_discover_exception.patch (1.0K, 3-Auto_discover_exception.patch)
  download | inline diff:
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index 5caf604..e4c9c48 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -509,7 +509,16 @@ def create_app(app_name=None):
                 ):
                     svr_name = registry.get(section, 'Description')
                     svr_superuser = registry.get(section, 'Superuser')
-                    svr_port = registry.getint(section, 'Port')
+
+                    # getint function throws exception if value is blank.
+                    # Ex: Port=
+                    # In such case we should handle the exception and continue
+                    # to read the next section of the config file.
+                    try:
+                        svr_port = registry.getint(section, 'Port')
+                    except ValueError:
+                        continue
+
                     svr_discovery_id = section
                     description = registry.get(section, 'Description')
                     data_directory = registry.get(section, 'DataDirectory')


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [pgadmin4][Patch]: Fixed minor issue in auto discover server when entry is blank in the config file
  2018-06-21 07:32 [pgadmin4][Patch]: Fixed minor issue in auto discover server when entry is blank in the config file Akshay Joshi <[email protected]>
@ 2018-06-21 20:35 ` Dave Page <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Page @ 2018-06-21 20:35 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers

Thanks, applied.

On Thu, Jun 21, 2018 at 8:32 AM, Akshay Joshi <[email protected]
> wrote:

> Hi Hackers,
>
> I have found one minor issue in auto discovery logic. *getint* function
> of ConfigParser throws exception if the value of the parameter is blank
> in the config file. Example: *Port=*
>
> Because of that exception pgAdmin4 unable to discover all the valid
> servers. Attached is the patch to fix that. Please review it.
>
> --
> *Akshay Joshi*
>
> *Sr. Software Architect *
>
>
>
> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-06-21 20:35 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-21 07:32 [pgadmin4][Patch]: Fixed minor issue in auto discover server when entry is blank in the config file Akshay Joshi <[email protected]>
2018-06-21 20:35 ` Dave Page <[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