strands-project / mongodb_store

MongoDB tools for storing and analysing runs of ROS systems.
BSD 3-Clause "New" or "Revised" License
49 stars 72 forks source link

[mongodb_store/scripts/mongodb_server.py] connect with localhost when shutdown server #175

Closed furushchev closed 7 years ago

furushchev commented 7 years ago

shutdown command is available only when client is connected to localhost. Otherwise, shutdown command fails with error like below:

OperationFailure: command SON([('shutdown', 1)]) failed: unauthorized: this command must run from localhost when running db without auth

In this pull request instead, client is connected to localhost only on shutdown.

strands-jenkins commented 7 years ago

Can one of the STRANDS admins verify this patch? Post a comment containing "ok to test" to enable Jenkins builds for this pull request.

furushchev commented 7 years ago

Also please note that environment variable HOSTNAME is not always set even if bash returns echo $HOSTNAME and in most case this param is set to localhost. https://github.com/strands-project/mongodb_store/blob/hydro-devel/mongodb_store/launch/mongodb_store_inc.launch#L33 you can check by

import os
print os.environ.get("HOSTNAME") # this may return None

I think that is why we could not catch this error. On some test environment (e.g. in docker container, env HOSTNAME is set to the container name), testing fails with this error on the second time and more.

hawesie commented 7 years ago

ok to test

hawesie commented 7 years ago

So this means that the mongo_server script must run on the same machine as the mongodb server itself?

furushchev commented 7 years ago

@hawesie Yes. And I think it does not occur any trouble, because it is the only case. (If you want to start mongod on a remote machine, you will have to add machine tag on launch file, then mongodb_server.py script will be executed on the same machine as mongod.)

hawesie commented 7 years ago

Cool, thanks!

furushchev commented 7 years ago

@hawesie Thanks for merging!

furushchev commented 7 years ago

@hawesie Please release because we use this package for testing our many packages.

hawesie commented 7 years ago

Yep, will do it soon. Are you getting the packages from our repo or the main ROS one?

furushchev commented 7 years ago

@hawesie Thanks! We usually use ros-shadow-fixed for installing dependencies.

hawesie commented 7 years ago

It's just gone into the ROS packages as a release. I don't know how long it will take them to rebuild everything.

furushchev commented 7 years ago

@hawesie Thank you very much! New version that includes this fix is 0.1.28, right? This is already available on apt repository.

$ apt-cache show ros-indigo-mongodb-store
Package: ros-indigo-mongodb-store
Version: 0.1.28-1trusty-20161109-131858-0800
Architecture: amd64
Maintainer: Chris Burbridge <cburbridge@gmail.com>
Installed-Size: 1732
Depends: libboost-filesystem1.54.0, libboost-system1.54.0, libboost-thread1.54.0, libc6 (>= 2.14), libgcc1 (>= 1:4.1.1), libssl1.0.0 (>= 1.0.0), libstdc++6 (>= 4.6), libmongo-client-dev, mongodb, mongodb-dev, python-pymongo, ros-indigo-geometry-msgs, ros-indigo-mongodb-store-msgs, ros-indigo-roscpp, ros-indigo-rospy, ros-indigo-std-msgs, ros-indigo-std-srvs
Homepage: http://www.ros.org/wiki/mongodb_store
Priority: extra
Section: misc
Filename: pool/main/r/ros-indigo-mongodb-store/ros-indigo-mongodb-store_0.1.28-1trusty-20161109-131858-0800_amd64.deb
Size: 319790
SHA256: 0e586c21cdf998088df946d553e1d78aba9bbdbc253cd73f079851f67b4ef6b9
SHA1: e1f7501917502f205dce2d2a6e52e16149e7274a
MD5sum: 98b0d0f88bdbcbf4f7d3432813150a91
Description: A package to support MongoDB-based storage and analysis for data from a ROS system, eg.
 saved messages, configurations etc
Description-md5: 5f387f4c03c360cc2324189535afba38