Community: Framework mailing list archives

expert-framework@mail.odoo.com

Re: OpenERP v7.0 Database Dump PermissionDenied (BUG?)

by
Boniface Irungu
- 12/17/2014 02:56:21
Hi,

The password is usually located in a file named "openerp-server.conf". Please check this file. it is located in your openerp server directory.

I would suggest when starting openerp just pass in the config file as a parameter.

for example.

/opt/openerp/v7/openerp-server --config=/opt/openerp/v7/debian/openerp-server.config

The above depends on your server installation directory and location of your config file. This is the best way to start openerp because you will have control on what password to use, location of log files etc.

Note:

Sometime back I used the openerp interface to dump a client db but the dumped db missed key tables constraints. So I suggest you use psql and pg_restore commands instead of the openerp database dump tool. Note that if your database becomes large, openerp interface dump tool will not work!

hope this helps you.


On Tue, Dec 16, 2014 at 6:18 PM, Boender, Ferry <f.boender@flusso.nl> wrote:
Hey all,

(First off, I'm no OpenERP/Odoo expert; though I know quite a bit of Python).

I ran into an issue on our OpenERP v7.0 (Ubuntu package v7.0-20130312-002112-1 from http://nightly.openerp.com/7.0/nightly/deb/).

Creating database dumps through the web interface using the database administrator interface has started giving AccessDenied errors. I'm certain we're using the correct password because I create new databases, delete them and change the password through the interface. I'm using the password from the 'admin_passwd' setting from the configuration file.

I've dived into the Python source, and I think I've traced the problem to the following:

  web_services.py
    def exp_dump(self, db_name):
      with self._set_pg_password_in_environment():

The _set_pg_password_in_environment() is defined as (again, stripping some irrelevant stuff):

  def _set_pg_password_in_environment(self):
    """ On Win32, pg_dump (and pg_restore) require that
    :envvar:`PGPASSWORD` be set
    
   This context management method handles setting
    :envvar:`PGPASSWORD` iif win32 and the envvar is not already
    set, and removing it afterwards.
    """
    if os.name != 'nt' or os.environ.get('PGPASSWORD'):
      yield
    else:
       os.environ['PGPASSWORD'] = tools.config['db_password']
       try:
          yield
       finally:
          del os.environ['PGPASSWORD']

The docstring says "if win32 and the envvar is not already set". Yet the code tests whether the OS is not 'nt' OR the environment is not set. Since I'm running on Ubuntu, this never sets the password in the environment. The exp_dump method also doesn't include it in the command it issues (['pg_dump', '--format=c', '--no-owner', '--username=openerp', '--host=localhost', '--port=5432', u'somedbname']) . Looking at another machine that *does* work properly, the line with the "os.name" check doesn't exist and is instead:

  if os.environ.get('PGPASSWORD') or not tools.config['db_password']:

Is my assumption correct that this is a bug in OpenERP, or is there some critical thing I'm not understanding about OpenERP configuration? For now I've "fixed" the issue by creating a .pgpass file in the openerp user's home dir, but that seems like a crude fix.

I'd be grateful if anybody can shine a light on this!

With kind regards,

Ferry

--
Ferry Boender
Consultant
M:06-23292583

Flusso B.V.
Hamersveldseweg 126
3833 GV Leusden
T: 033-4347680 

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe



--

Kind regards,

 

Boniface Irunguh

Software Developer - Python & PHP

OTB Africa Limited

Viewpark towers, 12th Floor

Off Uhuru Highway

TEL: +254 (0) 20 2498997

CELL: +254 (0) 712 122 743

MAIL: boniface@otbafrica.com

WEB: www.otbafrica.com , Mobile: m.otbafrica.com

POST: 22918-00100, Nairobi, Kenya

 

Enterprise Software | Mobile Application Solutions | Cloud Based Solutions | Custom Process Automation | SMS Service Development

 

DISCLAIMER:

 

The information contained in or attached to this email is intended exclusively for the use of the individual or entity to which it is addressed. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are not authorised to and must not disclose, copy, distribute, or retain this message or any part of it, consequently delete and destroy any hard copies of it and notify the sender. It may contain information which is confidential and/or covered by legal professional or other privilege.

 

The views expressed in this email are not necessarily the views of OTB Africa Limited, and the company, its directors, officers or employees make no representation or accept any liability for its accuracy or completeness unless expressly stated to the contrary. OTB Africa Limited acknowledges no liability for any damage that may be caused by any virus transmitted by this electronic mail.