Tests now passing again.
Merge remote-tracking branch 'refs/remotes/origin/master' into leadership-integration-tests

Conflicts:
	cmd/jujud/agent/agent.go
	cmd/jujud/machine_test.go
Mechanical refactoring complete.

This is only the fisrt phase designed to extract some functionality out of the main namespace and into its own package. Subsequent commits will massage this code into a more desirable state.
Merge remote-tracking branch 'refs/remotes/origin/master' into leadership-integration-tests

Conflicts:
	cmd/jujud/agent/agent_test.go
	cmd/jujud/agent/machine.go
	cmd/jujud/agent/machine_test.go
	cmd/jujud/bootstrap.go
	cmd/jujud/main.go
	cmd/jujud/unit_test.go
Implemented change from review.

- Moved fakeApi to bottom of the file.
- Removed state from MachineAgent as it is not needed.
- Removed commented-out code I missed in the first pass.
- Added comments to some previously private methods.
- Added package documentation to the agent package.
Merge remote-tracking branch 'refs/remotes/origin/master' into leadership-integration-tests

Conflicts:
	cmd/jujud/agent/agent_test.go
Merge remote-tracking branch 'refs/remotes/origin/master' into leadership-integration-tests

Conflicts:
	cmd/jujud/agent/upgrade_test.go
Corrected CloseWorker ctor.

- Now properly sets the logger to the logger passed in.
Merge pull request #1315 from katco-/leadership-integration-tests

Leadership integration tests

This is some refactoring to pull some requisite structures out of the main namespace.

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