Pass net.Listener into apiserver.NewServer

The dummy provider will soon be changed to
create a net.Listener with an ephemeral port,
and then later use this Listener in its
embedded apiserver.Server.

In this PR, we change apiserver.NewServer
to accept a Listener, as opposed to creating
one internally. This also opens the door to
testing without a TCP-based listener (e.g.
using a mock listener than returns in-memory
net.Conns created with net.Pipe).

This PR also records the ephemeral port as
api-port in the dummy provider's environment
config; this will be used in a future change
to use api-port as the basis of computing the
API server addresses.
Update dependencies to pull in new repos with licensing fixed
Merge pull request #331 from axw/apiserver-inject-listener

Pass net.Listener into apiserver.NewServer

The dummy provider will soon be changed to
create a net.Listener with an ephemeral port,
and then later use this Listener in its
embedded apiserver.Server.

In this PR, we change apiserver.NewServer
to accept a Listener, as opposed to creating
one internally. We record the ephemeral port
as api-port in the dummy provider's environment
config; this will be used in a future change
to use api-port as the basis of computing the
API server addresses, as we do in normal operation.

This change also opens the door to testing without
a TCP-based listener (e.g. using a mock listener
than returns in-memory net.Conns created with
net.Pipe).
Change Environ.StateInfo to StateServerInstances

Provider implementations should not have to know
about API or Mongo connection details; this should
be provider-independent. Thus, the StateInfo method
of Environ has been replaced with a method that
returns the set of known state server instances.

Ideally the provider would not need to know about
tracking "state servers" either, but rather have
a means of identifying instances with a tag specified
by Juju.

The local, dummy and manual provider
StateServerInstances methods are updated to return
the trivially known instance IDs without consulting
cloud storage. The other providers have been left
alone, and will be dealt with in future PRs.

This is both abstraction cleanup and a requirement
for moving away from requiring cloud storage. Future
changes will update individual providers to break
the dependency on cloud storage, e.g. by using
instance tagging. This involves updating each provider's
StateServerInstances, as well as changing how Juju
checks if an environment is already bootstrapped.
Merge pull request #332 from wallyworld/more-licence-fixes

Update dependencies to pull in new repos with licensing fixed

This is required for compliance with the licensing rules to allow Juju to be included in trusty
cmd/jujud: upgrade status & error handling

The fact that a machine agent is upgrading is now reported in
status. Upgrade errors are now also reported in status.

If an upgrade fails completely the machine agent will now never signal
that the upgrade is done. This prevents the majority of workers from
running, preventing the agent from becoming fully operational without
the upgrade being complete (which could be dangerous). At this point
the user would need to take steps to manually recover.
Merge pull request #333 from mjs/upgrade-status-reporting

cmd/jujud: upgrade status & error handling

The fact that a machine agent is upgrading is now reported in status. Upgrade errors are now also reported in status.

If an upgrade fails completely the machine agent will now never signal that the upgrade is done. This prevents the majority of workers from running, preventing the agent from becoming fully operational without the upgrade being complete (which could be dangerous). At this point the user would need to take steps to manually recover.
juju: update error message
Merge pull request #336 from axw/environ-stateserverinstances

Change Environ.StateInfo to StateServerInstances

Provider implementations should not have to know
about API or Mongo connection details; this should
be provider-independent. Thus, the StateInfo method
of Environ has been replaced with a method that
returns the set of known state server instances.

Ideally the provider would not need to know about
tracking "state servers" either, but rather have
a means of identifying instances with a tag specified
by Juju.

The local, dummy and manual provider
StateServerInstances methods are updated to return
the trivially known instance IDs without consulting
cloud storage. The other providers have been left
alone, and will be dealt with in future PRs.

This is both abstraction cleanup and a requirement
for moving away from requiring cloud storage. Future
changes will update individual providers to break
the dependency on cloud storage, e.g. by using
instance tagging. This involves updating each provider's
StateServerInstances, as well as changing how Juju
checks if an environment is already bootstrapped.
provider/azure: use labels to track state servers

StateServerInstances is updated to call AllInstances
and then inspect the cloud service labels. In 1.19
we started recording which cloud services are state-
servers. For backwards compatibility, we load the
provider-state file if we find any old-style instance
IDs.
Merge pull request #337 from axw/provider-azure-stateserverinstances-tags

provider/azure: use labels to track state servers

StateServerInstances is updated to call AllInstances and then inspect the
cloud service labels. In 1.19 we started recording which cloud services are
state- servers. For backwards compatibility, we load the provider-state
file if we find any old-style instance IDs.
Moved and harmonized style guide.
Merge pull request #338 from TheMue/doc-harmonize-contributions

Moved and harmonized style guide.

Files have been in two different folders. Additionally some internal changes, eg. headings with hashes (better for heading 3 etc.).
Bootstrap no longer cleans up if it can't tell whether an environment is bootstrapped or not.
Merge pull request #319 from katco-/lp-1340893-bootstrap-destroy

Bootstrap no longer cleans up if it can't tell whether an environment is bootstrapped or not.

Added a test to simulate an instance in which this might occur. Tested locally; some tests were failing, but they looked innocuous and related to connecting to mongo, not these changes.
Related to https://bugs.launchpad.net/juju-core/+bug/1340893
Merge branch 'master' into copy-sessions
Merge branch 'copy-sessions' of github.com:voidspace/juju into copy-sessions