Add windows userdata support

* refactor cloudinit packages to include support for windows userdata
* fix NewMachineConfig to store corect paths when on windows
remove global CloudInitOutputLog
Refactor Bootstrap

This is a step towards eliminating our reliance
on provider storage, specifically for supporting
the uploading of tools during bootstrap. A followup
PR will remove the EnsureToolsAvailability function
and make environs/bootstrap solely responsible for
locating and delivering tools to the bootstrapped
instances.

- Environ.Bootstrap now returns the architecture
  and series of the started instance, and a function
  that must be called to finalize the bootstrap
  process. The caller is responsible for filling in
  the Tools of the machine config that is passed in
  to the finalizer.
- environs/bootstrap.Bootstrap now generates the
  system SSH key, and then calls Environ.Bootstrap;
  it finds appropriate tools for the instance based
  on the architecture and series reported, and then
  calls the finalizer.

There are some other refactoring changes:
 - MachineConfig.Constraints is now set by
   NewBootstrapMachineConfig, not FinishMachineConfig;
   only bootstrap machine configs actually set it,
   and the constraints do not change during the bootstrap
   process.
 - environs/manual/bootstrap*.go have been deleted,
   and the minimally required logic moved into
   provider/manual.
cmd/jujud: avoid potential race for UpgradedToVersion

Store the initial UpgradedToVersion as the the machine agent starts up
and use that when deciding whether HA initialisation is
required. Previously it could have been possible for the upgrade-steps
worker to update UpgradedToVersion before ensureMongoServer got to
check it.

The new previousAgentVersion field will also be useful for other
upcoming changes.
cmd/jujud: update upgradedToVersion even when upgrade mode is skipped

Recent changes to avoid entering "upgrade mode" unnecessarily have
meant that the upgradedToVersion field in a machine agent's config
wasnt't getting updated whenever upgrade mode is skipped. This can
have a variety of negative effects.

This change fixes that by writing the current version to agent.conf
when upgrade mode is skipped.
Update comments, fix test
state/apiserver/keymanager: canRead/canWrite is not a common.AuthFunc

This PR is a prereq of #556.

On investigation the `canRead`, `canWrite` authz methods in the keymanager are not implementations of `common.AuthFunc` as they do not use tags.

Although with the current defintion of `common.AuthFunc` the are interchangable, when #556 lands they not be as the `user` field transmitted over the api is not a tag.

To make this clear, stop defining `canRead` and `canWrite` in terms of `common.AuthFunc` to make this difference crystal clear.
logic cleanup, remove TODO
provider/common: fix test

expect version.Current.Series, not hard-coded "trusty"
responding to review feedback
Merge pull request #566 from mjs/write-upgradedToVersion-even-when-no-upgrade

Write upgraded to version even when no upgrade

Two related changes here:

1. Store the initial UpgradedToVersion as the the machine agent starts up and use that when deciding whether HA initialisation is required. Previously it could have been possible for the upgrade-steps worker to update UpgradedToVersion before ensureMongoServer got to check it.
2. Recent changes to avoid entering "upgrade mode" unnecessarily have meant that the upgradedToVersion field in a machine agent's config wasnt't getting updated whenever upgrade mode is skipped. This canhave a variety of negative effects.

This change fixes that by writing the current version to agent.conf when upgrade mode is skipped.

See also: https://bugs.launchpad.net/juju-core/+bug/1359484
Ensure floating IP is used as public address for openstack
Fix comment
Try again

Use PreferredSeries, not version.Current.Series.
Merge pull request #571 from davecheney/183-state-apiserver-keymanager-canread-is-not-an-authfunc

state/apiserver/keymanager: canRead/canWrite is not a common.AuthFunc

This PR is a prereq of #556.

On investigation the `canRead`, `canWrite` authz methods in the keymanager are not implementations of `common.AuthFunc` as they do not use tags.

Although with the current defintion of `common.AuthFunc` the are interchangable, when #556 lands they not be as the `user` field transmitted over the api is not a tag.

To make this clear, stop defining `canRead` and `canWrite` in terms of `common.AuthFunc` to make this difference crystal clear.
Merge pull request #574 from wallyworld/use-floatingip-as-public-address

Ensure floating IP is used as public address for openstack

Fixes https://bugs.launchpad.net/juju-core/+bug/1348287

If a floating IP address is requested for an Openstack instance, we know that will be the public address. That one should be reported as such instead of trying to guess. Often the guesses can be wrong.
Merge pull request #557 from axw/environ-bootstrap-upload-tools

Refactor Bootstrap

This is a step towards eliminating our reliance
on provider storage, specifically for supporting
the uploading of tools during bootstrap. A followup
PR will remove the EnsureToolsAvailability function
and make environs/bootstrap solely responsible for
locating and delivering tools to the bootstrapped
instances.

- Environ.Bootstrap now returns the architecture
  and series of the started instance, and a function
  that must be called to finalize the bootstrap
  process. The caller is responsible for filling in
  the Tools of the machine config that is passed in
  to the finalizer.
- environs/bootstrap.Bootstrap now generates the
  system SSH key, and then calls Environ.Bootstrap;
  it finds appropriate tools for the instance based
  on the architecture and series reported, and then
  calls the finalizer.

There are some other refactoring changes:
 - MachineConfig.Constraints is now set by
   NewBootstrapMachineConfig, not FinishMachineConfig;
   only bootstrap machine configs actually set it,
   and the constraints do not change during the bootstrap
   process.
 - environs/manual/bootstrap*.go have been deleted,
   and the minimally required logic moved into
   provider/manual.
fixed a bson tag problem and style changes to metric uuid field
Merge pull request #581 from mattyw/metric-uuid-fix

fixed a bson tag problem and style changes to metric uuid field
Merge pull request #579 from gabriel-samfira/add-windows-userdata

Add windows userdata support

This is the same as #189 but with a fix for [bug-1359333](https://bugs.launchpad.net/juju-core/+bug/1359333)

Tests pass locally, ran bootstrap from Windows, created staging branch and successfully deployed both windows and ubuntu.