Skip to content

Error authenticating with mongo 3.0 #17

Open
@rchamorro

Description

@rchamorro

When using mongodb_backend with authentication we have this error when updating a module (giscedata_telegestion_comer):

Traceback (most recent call last):
File "./openerp-server.py", line 112, in <module>
tools.config['update'])
File "/home/erp/src/erp/server/bin/pooler.py", line 42, in get_db_and_pool
addons.load_modules(db, force_demo, status, update_module)
File "/home/erp/src/erp/server/bin/addons/init.py", line 786, in load_modules
r = load_module_graph(cr, graph, status, report=report)
File "/home/erp/src/erp/server/bin/addons/init.py", line 630, in load_module_graph
init_module_objects(cr, package.name, modules)
File "/home/erp/src/erp/server/bin/addons/init.py", line 374, in init_module_objects
result = obj._auto_init(cr, {'module': module_name})
File "/home/erp/src/erp/server/bin/addons/mongodb_backend/orm_mongodb.py", line 52, in _auto_init
db = mdbpool.get_db()
File "/home/erp/src/erp/server/bin/addons/mongodb_backend/mongodb2.py", line 225, in get_db
raise except_orm('MongoDB connection error', e)
osv.orm.except_orm: error -- MongoDB connection error
error -- MongoDB connection error

We were able to solve it changing the uri property of mongodb2.py to not include the database name. Like this:

Line 137:

uri_tmpl = 'mongodb://%s:%s@%s:%s/?authMechanism=%s'
uri = uri_tmpl % (tools.config['mongodb_user'],
                                  tools.config['mongodb_pass'],
                                  tools.config['mongodb_host'],
                                  tools.config['mongodb_port'],                                  
                                  tools.config['mongodb_auth'])

But it then it fails authenticating with normal usage of the module :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions