Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work with pymongo version 3 #8

Open
GuusH opened this issue May 8, 2015 · 4 comments
Open

Does not work with pymongo version 3 #8

GuusH opened this issue May 8, 2015 · 4 comments

Comments

@GuusH
Copy link
Contributor

GuusH commented May 8, 2015

Hi,

I've been upgrading our MongoDB installation. MongoDB version 3 recommends or requires pymongo version 2.8 or newer (see http://docs.mongodb.org/manual/release-notes/3.0-compatibility/). Currently we're using pymongo 2.6.2 which works fine with MongoDB 2.6. If I upgrade pymongo using pip to the current version (3.0.1), this module no longer works. It tries this:

try:
    from pymongo.connection import Connection
except ImportError:
    Connection = None

Which fails. It raises this exception when trying to run it:

[1431011592] ERROR: [Shinken] The module mongodbretention raised an exception Cannot find the module python-pymongo. Please install both., I remove it! traceback=Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/shinken/modulesmanager.py", line 174, in get_instances
    inst = module.get_instance(mod_conf)
  File "/var/lib/shinken/modules/retention-mongodb/module.py", line 65, in get_instance
    raise Exception('Cannot find the module python-pymongo. Please install both.')
Exception: Cannot find the module python-pymongo. Please install both.

With pymongo 3.0.1:

$ python
Python 2.7.3 (default, Dec 18 2014, 19:10:20)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pymongo.connection import Connection
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named connection
>>> import pymongo

With pymongo 2.6.2:

# python
Python 2.7.3 (default, Dec 18 2014, 19:10:20)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pymongo.connection import Connection

It looks like the preferred way of connecting to Mongo using this module is like so (which also works in older versions in 2.6.2):

>>> from pymongo import MongoClient
>>> client = MongoClient('mongodb://localhost:27017/')

I'll see if I can create a patch when I have time.

@GuusH
Copy link
Contributor Author

GuusH commented May 8, 2015

See #9

@olivierHa
Copy link
Member

Hello,

Some modifications has been merged. Could you re-test with master version ?

Olivier

@clonedagain
Copy link
Contributor

As far as I can tell, master works fine and pushing it to shinken.io would fix the issue.

@maethor
Copy link

maethor commented Oct 8, 2020

Hi, I just pushed a new version (2.0.0). I invite you to test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants