Community: Framework mailing list archives
Re: OpenERP v7.0 Database Dump PermissionDenied (BUG?)by
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.pydef 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 setThis context management method handles setting:envvar:`PGPASSWORD` iif win32 and the envvar is not alreadyset, and removing it afterwards."""if os.name != 'nt' or os.environ.get('PGPASSWORD'):yieldelse:os.environ['PGPASSWORD'] = tools.config['db_password']try:yieldfinally: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
3833 GV Leusden
Post to: mailto:email@example.com
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
POST: 22918-00100, Nairobi, Kenya
Enterprise Software | Mobile Application Solutions | Cloud Based Solutions | Custom Process Automation | SMS Service Development
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.