10gen / mongo-orchestration

Apache License 2.0
7 stars 11 forks source link

mongodb_auth_uri for a replica set created through MO should contain the replica set name #200

Closed amidvidy closed 9 years ago

amidvidy commented 9 years ago

When creating a replica set using the basic.json configuration, and querying for the resource with it's ID e.g.

$ curl localhost:8889/v1/replica_sets/acd55bfd-203f-432a-9eeb-6ad5134275bf | python -m json.tool`
... lots of fields...
 "mongodb_uri": "mongodb://localhost:1026,localhost:1028,localhost:1029/?replicaSet=acd55bfd-203f-432a-9eeb-6ad5134275bf",
"orchestration": "replica_sets"
}

As expected, the mongodb_uri has a replicaSet parameter. However, if we create a replica set using the auth.json configuration, we need to use the mongodb_auth_uri field of the response so we get a connection string with the authentication parameters.

$ curl localhost:8889/v1/replica_sets/repl0 | python -m json.tool
... lots of fields ...
"mongodb_auth_uri": "mongodb://bob:pwd123@localhost:27017,localhost:27018,localhost:27019/?authSource=admin",
 "mongodb_uri": "mongodb://localhost:27017,localhost:27018,localhost:27019/?replicaSet=repl0",
 "orchestration": "replica_sets"
}

Note that the mongodb_auth_uri does not contain the replicaSet name. In the C++ driver, this causes an "Invalid Connection String" error.

llvtt commented 9 years ago

resolved in 619df6bbb428185b0c77b7b1e3352210ae2f6d77

amidvidy commented 9 years ago

Thanks for the quick fix @llvtt! Would you mind tagging a new minor version so we can get this fix out on evergreen builders?

llvtt commented 9 years ago

Sure thing. Just pushed 0.4.2 to pypi!