juju/juju — pull request #498 by axw (2014-08-12 09:30:52+00:00)
Title: Only login to "admin" mongo database

We create a user in the admin database with read/write privileges to all
databases, so there's no need to add users to each other database.
Consequently, we can remove the mongo.SetMongoPassword function and change
state.Machine.SetMongoPassword to just call mongo.SetAdminMongoPassword.

mongo.SetAdminMongoPassword no longer calls Login itself.

This is a reimplementation of PR #414, which was broken. Previously
SetAdminMongoPassword would call Login, which meant machine-0 would
login as machine-1, machine-2, etc. This would break when the other
machine came up and its agent changed the password for that user.

Also:
- state: remove unit.SetMongoPassword
- agent: initialise mongo admin user before initialising state

This allows us to open mongo fully authenticated when opening
state, thus allowing the use of session.Copy.