public inbox for [email protected]  
help / color / mirror / Atom feed
[Pgadmin] [Docker] servers.json import fails when running in desktop mode
4+ messages / 3 participants
[nested] [flat]

* [Pgadmin] [Docker] servers.json import fails when running in desktop mode
@ 2019-12-13 14:52 Levitt Olivier <[email protected]>
  2019-12-14 04:52 ` Re: [Pgadmin] [Docker] servers.json import fails when running in desktop mode Ashesh Vashi <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Levitt Olivier @ 2019-12-13 14:52 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

When running the docker image in desktop mode (PGADMIN_CONFIG_SERVER_MODE=False), no user is created. That is expected behaviour.
But then the code that imports the servers.json pre-configuration fails as it ties the import to the default user.  

I think line 40 of entrypoint.sh (https://git.postgresql.org/gitweb/?p=pgadmin4.git;a=blob;f=pkg/docker/entrypoint.sh;h=47d14bf2d41577...) should not specify a user when running in dekstop mode. 
I tested it without --user parameter and it successfully imported the servers.json configuration.

Should I submit a patch ? First time contributing to Pgadmin :)

Regards,
Olivier Levitt





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

* Re: [Pgadmin] [Docker] servers.json import fails when running in desktop mode
  2019-12-13 14:52 [Pgadmin] [Docker] servers.json import fails when running in desktop mode Levitt Olivier <[email protected]>
@ 2019-12-14 04:52 ` Ashesh Vashi <[email protected]>
  2019-12-16 09:48   ` RE: [Pgadmin] [Docker] servers.json import fails when running in desktop mode Levitt Olivier <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Ashesh Vashi @ 2019-12-14 04:52 UTC (permalink / raw)
  To: Levitt Olivier <[email protected]>; +Cc: pgadmin-hackers

<http://www.linkedin.com/in/asheshvashi;

On Sat, Dec 14, 2019 at 3:53 AM Levitt Olivier <[email protected]>
wrote:

> Hi,
>
> When running the docker image in desktop mode
> (PGADMIN_CONFIG_SERVER_MODE=False), no user is created. That is expected
> behaviour.
> But then the code that imports the servers.json pre-configuration fails as
> it ties the import to the default user.
>
> I think line 40 of entrypoint.sh (
> https://git.postgresql.org/gitweb/?p=pgadmin4.git;a=blob;f=pkg/docker/entrypoint.sh;h=47d14bf2d41577...)
> should not specify a user when running in dekstop mode.
> I tested it without --user parameter and it successfully imported the
> servers.json configuration.
>
> Should I submit a patch ? First time contributing to Pgadmin :)
>
Please do.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company
<http://www.enterprisedb.com;


*http://www.linkedin.com/in/asheshvashi*
<http://www.linkedin.com/in/asheshvashi;

>
> Regards,
> Olivier Levitt
>
>
>


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

* RE: [Pgadmin] [Docker] servers.json import fails when running in desktop mode
  2019-12-13 14:52 [Pgadmin] [Docker] servers.json import fails when running in desktop mode Levitt Olivier <[email protected]>
  2019-12-14 04:52 ` Re: [Pgadmin] [Docker] servers.json import fails when running in desktop mode Ashesh Vashi <[email protected]>
@ 2019-12-16 09:48   ` Levitt Olivier <[email protected]>
  2019-12-17 07:45     ` Re: [Pgadmin] [Docker] servers.json import fails when running in desktop mode Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Levitt Olivier @ 2019-12-16 09:48 UTC (permalink / raw)
  To: Ashesh Vashi <[email protected]>; +Cc: pgadmin-hackers

Hi,

Here is a patch (first contribution \o/) that solves the issue by importing the servers.json anonymously when running in DESKTOP mode.  
There may be a better way to check if we are running in DESKTOP mode or not but checking PGADMIN_CONFIG_SERVER_MODE should be enough when running pgadmin4 in docker.  

Regards,
Olivier Levitt


________________________________________
From: Ashesh Vashi [[email protected]]
Sent: 14 December 2019 05:52
To: Levitt Olivier
Cc: [email protected]
Subject: Re: [Pgadmin] [Docker] servers.json import fails when running in desktop mode

<http://www.linkedin.com/in/asheshvashi;

On Sat, Dec 14, 2019 at 3:53 AM Levitt Olivier <[email protected]<mailto:[email protected]>> wrote:
Hi,

When running the docker image in desktop mode (PGADMIN_CONFIG_SERVER_MODE=False), no user is created. That is expected behaviour.
But then the code that imports the servers.json pre-configuration fails as it ties the import to the default user.

I think line 40 of entrypoint.sh (https://git.postgresql.org/gitweb/?p=pgadmin4.git;a=blob;f=pkg/docker/entrypoint.sh;h=47d14bf2d41577...) should not specify a user when running in dekstop mode.
I tested it without --user parameter and it successfully imported the servers.json configuration.

Should I submit a patch ? First time contributing to Pgadmin :)
Please do.


--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company<http://www.enterprisedb.com;


http://www.linkedin.com/in/asheshvashi

Regards,
Olivier Levitt




Attachments:

  [text/x-patch] import_servers_on_desktop_mode.diff (978B, 2-import_servers_on_desktop_mode.diff)
  download | inline diff:
diff --git a/pkg/docker/entrypoint.sh b/pkg/docker/entrypoint.sh
index 47d14bf2d..e8434329d 100755
--- a/pkg/docker/entrypoint.sh
+++ b/pkg/docker/entrypoint.sh
@@ -37,7 +37,13 @@ if [ ! -f /var/lib/pgadmin/pgadmin4.db ]; then
     export PGADMIN_SERVER_JSON_FILE=${PGADMIN_SERVER_JSON_FILE:-/pgadmin4/servers.json}
     # Pre-load any required servers
     if [ -f "${PGADMIN_SERVER_JSON_FILE}" ]; then
-        /usr/local/bin/python /pgadmin4/setup.py --load-servers "${PGADMIN_SERVER_JSON_FILE}" --user ${PGADMIN_DEFAULT_EMAIL}
+        # When running in Desktop mode, no user is created
+        # so we have to import servers anonymously
+        if [ "${PGADMIN_CONFIG_SERVER_MODE}" = "False" ]; then
+            /usr/local/bin/python /pgadmin4/setup.py --load-servers "${PGADMIN_SERVER_JSON_FILE}" 
+        else
+            /usr/local/bin/python /pgadmin4/setup.py --load-servers "${PGADMIN_SERVER_JSON_FILE}" --user ${PGADMIN_DEFAULT_EMAIL}
+        fi
     fi
 fi
 


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

* Re: [Pgadmin] [Docker] servers.json import fails when running in desktop mode
  2019-12-13 14:52 [Pgadmin] [Docker] servers.json import fails when running in desktop mode Levitt Olivier <[email protected]>
  2019-12-14 04:52 ` Re: [Pgadmin] [Docker] servers.json import fails when running in desktop mode Ashesh Vashi <[email protected]>
  2019-12-16 09:48   ` RE: [Pgadmin] [Docker] servers.json import fails when running in desktop mode Levitt Olivier <[email protected]>
@ 2019-12-17 07:45     ` Akshay Joshi <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Akshay Joshi @ 2019-12-17 07:45 UTC (permalink / raw)
  To: Levitt Olivier <[email protected]>; +Cc: Ashesh Vashi <[email protected]>; pgadmin-hackers

Thanks, patch applied.

On Mon, Dec 16, 2019 at 4:42 PM Levitt Olivier <[email protected]>
wrote:

> Hi,
>
> Here is a patch (first contribution \o/) that solves the issue by
> importing the servers.json anonymously when running in DESKTOP mode.
> There may be a better way to check if we are running in DESKTOP mode or
> not but checking PGADMIN_CONFIG_SERVER_MODE should be enough when running
> pgadmin4 in docker.
>
> Regards,
> Olivier Levitt
>
>
> ________________________________________
> From: Ashesh Vashi [[email protected]]
> Sent: 14 December 2019 05:52
> To: Levitt Olivier
> Cc: [email protected]
> Subject: Re: [Pgadmin] [Docker] servers.json import fails when running in
> desktop mode
>
> <http://www.linkedin.com/in/asheshvashi;
>
> On Sat, Dec 14, 2019 at 3:53 AM Levitt Olivier <[email protected]
> <mailto:[email protected]>> wrote:
> Hi,
>
> When running the docker image in desktop mode
> (PGADMIN_CONFIG_SERVER_MODE=False), no user is created. That is expected
> behaviour.
> But then the code that imports the servers.json pre-configuration fails as
> it ties the import to the default user.
>
> I think line 40 of entrypoint.sh (
> https://git.postgresql.org/gitweb/?p=pgadmin4.git;a=blob;f=pkg/docker/entrypoint.sh;h=47d14bf2d41577...)
> should not specify a user when running in dekstop mode.
> I tested it without --user parameter and it successfully imported the
> servers.json configuration.
>
> Should I submit a patch ? First time contributing to Pgadmin :)
> Please do.
>
>
> --
>
> Thanks & Regards,
>
> Ashesh Vashi
> EnterpriseDB INDIA: Enterprise PostgreSQL Company<
> http://www.enterprisedb.com;
>
>
> http://www.linkedin.com/in/asheshvashi
>
> Regards,
> Olivier Levitt
>
>
>

-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


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


end of thread, other threads:[~2019-12-17 07:45 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-13 14:52 [Pgadmin] [Docker] servers.json import fails when running in desktop mode Levitt Olivier <[email protected]>
2019-12-14 04:52 ` Ashesh Vashi <[email protected]>
2019-12-16 09:48   ` Levitt Olivier <[email protected]>
2019-12-17 07:45     ` 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