Juju, mongo 2.6 and labix.org/v2/mgo issue
Ian Booth
ian.booth at canonical.com
Wed May 28 06:19:12 UTC 2014
Hi all
I'm testing Juju with Mongo 2.6 to evaluate how that affects our remaining
intermittent unit test failures.
I've compiled a copy of Mongo 2.6 and have been able to bootstrap an environment
with no issues. Great so far.
However, the tests aren't happy. eg the tests in agent/mongo fail as do a bunch
of others.
It seems Mongo 2.4 -> 2.6 has changed he way admin users are created. In Juju,
we have a EnsureAdminUser() function. It does this:
session.DB("admin").AddUser(p.User, p.Password, false)
That fails with:
not authorized for upsert on admin.system.users
Fine, so the AddUser API doc in the mgo driver says to use UpsertUser for mongo
2.4 or greater:
session.DB("admin").UpsertUser(
&mgo.User{Username: p.User, Password: p.Password,
Roles:[]mgo.Role{mgo.RoleUserAdminAny}})
It still fails the same way.
So I reverted to calling the createUser command directly as per the Mongo 2.6 docs:
session.DB("admin").Run(bson.D{
{"createUser", p.User},
{"pwd", p.Password},
{"roles", []mgo.Role{mgo.RoleUserAdminAny}}},
nil)
The above works for the initially failing tests in agent/mongo. I haven't re-run
the entire suite again though. It may be further tweaks are required.
I can easily continue using the last construct above, but it *seems* that the
mgo driver may need updating? Am I missing something?
More information about the Juju-dev
mailing list