Make ActionResult an Entity

so we can add it to AllWatcher
network: change SortHostPorts to maintain order of same-type addresses

HostPorts are meant to kept in their original order.
Change SortHostPorts to swap hostnames and to the fore
and give preference to either IPv4 or IPv6, but otherwise
keep the order within address type groups the same.
Remove SortHostPorts call from state.SetAPIHostPorts

Move the logic from state into the peergrouper. I'm
not sure why we're sorting the values before adding
them to state at all, but the logic should be kept
outside at any rate.
Reordered and renamed machine agent upgrade tests for clarity
Merge pull request #394 from axw/lp1345832-stable-sorthostports

Remove SortHostPorts call from state.SetAPIHostPorts

**state, worker/peergrouper:**

Move the logic from state into the peergrouper. I'm not sure why we're
sorting the values before adding them to state at all, but the logic should
be kept outside at any rate.

**network: change SortHostPorts to maintain order of same-type addresses**

HostPorts are meant to kept in their original order. Change SortHostPorts
to swap hostnames and to the fore and give preference to either IPv4 or
IPv6, but otherwise keep the order within address type groups the same.

Fixes https://bugs.launchpad.net/juju-core/+bug/1345832
Update to gopkg.in/mgo.v2 repository

labix.org/v2/mgo is no longer maintained.
Update tests to match mgo's new behaviour
Merge pull request #408 from davecheney/158-lets-have-less-copies-of-the-tagged-authenticator-interface

Removed unused taggedAuthenticator interface
Merge pull request #409 from axw/update-mgo-gopkgin

Update to gopkg.in/mgo.v2 repository

labix.org/v2/mgo is no longer maintained.
cmd/jujud: added supporting logic to have state servers sync before starting upgrades

This change has no functional impact but implements the machine agent
changes to make state machine agents wait for each other to be ready
before proceeding with an upgrade. Right now no wait is actually
performed. TODOs have been inserted for the parts that rely on
upcoming changes.
Clarified handling of data in upgradeWorkerContext

Keep everything in the struct instead of attaching some bits to the
struct and passing other bits around. Make the code clearer by using a
bool to explicitly say when an upgrade is running on a state server.
Merge pull request #407 from mjs/pre-upgrade-state-machine-sync-prep

cmd/jujud: added supporting logic to have state servers sync before starting upgrades

This change has no functional impact but implements the machine agent changes to make state machine agents wait for each other to be ready before proceeding with an upgrade. Right now no wait is actually performed. TODOs have been inserted for the parts that rely on upcoming changes.

Note to reviewers: this PR includes 2 commits the first of which is a rearrangement of the machine agent upgrade tests to aid clarity. It may be easier to follow the changes in this PR if the commits are viewed separately.
action-get in jujuc

Hooks can now run the command action-get to retrieve the map of params
passed with the action hook.  In the case of a nil params map, an empty
value will be passed.  Format for the command is as follows:

action-get [--output=<json|yaml>] [key[.inner.value...]]

In the case of a nonexistent key, a nil interface will be returned to
the command Stdout writer, which will display it as an empty string or
null in the case of JSON output.
Corrected copyright date on action-get files
Fixed incorrect comment on action-get.go
Commented action-get recursion algorithm for clarity.
Fleshed out comments for methods exported for action-get.
In action-get_test, added negative tests and tests for fully exercising map recursion
Merge pull request #399 from binary132/actions-get

action-get in jujuc

Hooks can now run the command action-get to retrieve the map of params
passed with the action hook.  In the case of a nil params map, an empty
value will be passed.  Format for the command is as follows:

`action-get [--output=<json|yaml>] [key[.inner.value...]]`

For example,

`action-get --output=json outfile.compression` might output
```json
{"quality":"high","type":{"utility":"bzip2","flags": "--small"}}
```


In the case of a nonexistent key, a nil interface will be returned to
the command Stdout writer, which will display it as an empty string or
null in the case of JSON output.
merge from upstream master