state: introduce automatic multi-environment filtering

For collections that contain data for multiple environments,
getCollection now returns a wrapped collection that automatically
filters by environment UUID as required. This reduces the risk of
unintended data leakage between environments.

There are some areas where an actual mgo.Collection is required. These
now use the new State.getRawCollection method.

Now that this is handled automatically, this change also removes
several TODOs regarding filtering by environment UUID.

A later branch will remove all the now-unnecessary docID calls that
currently exist in state.
state: fixed service life handling in SetMetricCredentials

This method was adding the env UUID prefix onto an id that already had
the prefix when checking service life. This meant the life check was
never going to succeed and the associated test was passing for the
wrong reason (service not found instead of service is dying/dead).

The function was also only checking for the Dead state (but not
Dying). Based on the test, I have assumed that SetMetricCredentials is
only supposed to work if a service is alive so I've changed the
implementation to check for Alive instead of Dead.
state: populate env UUID on minUnitsDoc
Merge pull request #1240 from mjs/auto-env-uuid

state: introduce automatic multi-environment filtering

For collections that contain data for multiple environments, getCollection now returns a wrapped collection that automatically filters by environment UUID as required. This reduces  the risk of unintended data leakage between environments.

There are some areas where an actual mgo.Collection is required. These now use the new State.getRawCollection method.

Now that this is handled automatically, this change also removes several TODOs regarding filtering by environment UUID.

A later branch will remove all the now-unnecessary docID calls that currently exist in state.

(Review request: http://reviews.vapour.ws/r/551/)