Juju, mongo 2.6 and labix.org/v2/mgo issue

2014-05-27 Thread Ian Booth
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?

-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev


Re: Juju, mongo 2.6 and labix.org/v2/mgo issue

2014-05-28 Thread Gustavo Niemeyer
It's indeed being updated. The frequent sprints haven't been helping, but
I'm hoping to have a new release out next week.

gustavo @ http://niemeyer.net
On May 28, 2014 8:19 AM, "Ian Booth"  wrote:

> 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?
>
> --
> Juju-dev mailing list
> Juju-dev@lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju-dev
>
-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev