Re: Unified server/desktop config

From: Surinder Kumar <surinder(dot)kumar(at)enterprisedb(dot)com>
To: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Cc: Dave Page <dpage(at)pgadmin(dot)org>, Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
Subject: Re: Unified server/desktop config
Date: 2017-08-07 12:43:03
Message-ID: CAM5-9D-xXUjyex31SpxuTnEudc_CUDeVXruYW4mdBtxMw8+pGw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi,

The patch seems to work in Runtime mode, but fails in Server mode with
error:

(pgAdmin_27)Laptop195:pgadmin4 surinder$ python web/pgAdmin4.py
Traceback (most recent call last):
File "web/pgAdmin4.py", line 55, in <module>
exec(open(file_quote(setupfile), 'r').read())
File "<string>", line 35, in <module>
File "/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/setup/data_directory.py",
line 23, in create_app_data_directory
_create_directory_if_not_exists(os.path.dirname(config.SQLITE_PATH))
File "/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/setup/data_directory.py",
line 15, in _create_directory_if_not_exists
os.mkdir(_path)
OSError: [Errno 13] Permission denied: '/var/lib/pgadmin'
(pgAdmin_27)Laptop195:pgadmin4 surinder$

This is because the directory /var/lib/ has root only access and I am
running pgAdmin4 with the non-root user.

Also pgadmin directory is not created.

(pgAdmin_35)Laptop195:pgadmin4 surinder$ ls /var/lib/pgadmin
ls: /var/lib/pgadmin: No such file or directory

I got same error with MacOSX and Ubuntu-14.04 machines irrespective of
Python version.

Meanwhile, I am testing patch with other test cases.

Thanks,
Surinder

On Mon, Aug 7, 2017 at 4:33 PM, Surinder Kumar <
surinder(dot)kumar(at)enterprisedb(dot)com> wrote:

> On Mon, Aug 7, 2017 at 4:11 PM, Ashesh Vashi <
> ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
>
>> On Mon, Aug 7, 2017 at 3:59 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>
>>> Anyone?
>>>
>> Surinder - please give this one priority.
>>
> Sure
> ​.​
>
>
>>
>> --
>>
>> 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>
>>
>>>
>>> On Thu, Jul 20, 2017 at 5:03 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>>
>>>> All,
>>>>
>>>> Attached is a patch that aims to allow us to have a standardised config
>>>> that will work out of the box for both web and desktop modes. It does this
>>>> by doing two things:
>>>>
>>>> 1) The runtime sets SERVER_MODE in the Python environment before
>>>> starting the app. If this value is set, then it overrides the default value
>>>> of SERVER_MODE in the config.
>>>>
>>>> 2) The config file then offers default values for the various file
>>>> locations for both server and desktop mode, setting them appropriately
>>>> based on the derived SERVER_MODE value.
>>>>
>>>> The only downsides I can see from this are:
>>>>
>>>> - You cannot run in server mode in the runtime without manually
>>>> reconfiguring SERVER_MODE and likely a bunch of paths in config_local.py
>>>>
>>>> - If you want to override SERVER_MODE, you'll probably also need to
>>>> redefine the various paths in config_local.py.
>>>>
>>>> I don't see either being something 99.9% of users would need though.
>>>>
>>>> Can anyone see if the patch breaks anything, or if I missed any side
>>>> effects?
>>>>
>>>> Is it likely to break things during upgrades? I suspect so... so maybe
>>>> this should prompt v2.0?
>>>>
>>>> I'd appreciate multiple reviews of this, as it could break things. Note
>>>> that I haven't yet updated the docs.
>>>>
>>>> --
>>>> Dave Page
>>>> Blog: http://pgsnake.blogspot.com
>>>> Twitter: @pgsnake
>>>>
>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>> The Enterprise PostgreSQL Company
>>>>
>>>
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Wouter van Kesteren 2017-08-07 13:16:35 [PATCH] Work with newer Flask-Security.
Previous Message Surinder Kumar 2017-08-07 11:03:06 Re: Unified server/desktop config