Community: Framework mailing list archives
OpenERP v7.0 Database Dump PermissionDenied (BUG?)by
(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:
def exp_dump(self, db_name):
The _set_pg_password_in_environment() is defined as (again, stripping some irrelevant stuff):
""" 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'):
os.environ['PGPASSWORD'] = tools.config['db_password']
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,
3833 GV Leusden
3833 GV Leusden
Pedro M. Baeza