Fix bug in upgrade test

oldID is converted to a string. Which is different to the the bytes
version stored in the document.
Merge branch 'master' of https://github.com/juju/juju into fix-upgrade-bug
Runner now uses an interface, not a *HookContext; Flush is ~properly tested locally; Run* is ~properly tested by using the Context interface
consolidated yuckiness in HookContext.ActionData method
Merge branch 'master' of https://github.com/juju/juju into fix-upgrade-bug
Merge pull request #1011 from waigani/fix-upgrade-bug

Fix bug in upgrade test

oldID is converted to a string, which is different to the the bytes
version stored in the document.
Stop trying to use DNS name for ec2 public addresses
Drive by format fix
upgrades: moved Step and Context to their own files

In preparation for upcoming changes where State requiring upgrade
steps will be separated from API requiring ones.

Also removed unused "db" and "runner" fields from upgradeContext.
upgrades: introduce StateStep

It's now part of the Operation interface, but not used yet.
upgrades: StateSteps are now run as part of upgrades

All StateStep upgrade steps for a target are now run before other
upgrade steps. Existing migration steps still need to be migrated and
there's a number of cleanup steps required before this work can be
considered done.
upgrades: migrated steps that manipulate state directly to be defined as such
upgrades: introduced APIContext

This is a limited upgrade context give to upgrade steps that use only
the API. Existing steps like that have been updated to take APIContext
instead of Context.
upgrades: test refactoring

Extracted the common parts of mockStateUpgradeStep and
mockUpgradeStep, making the targets() helper unnecessary in the
process.
upgrades: various changes based on review feedback

The crux of this change is that the role of StateContext and
APIContext have been taken over by the base Context interface. This
also allows for a single step interface which allows for
simplifications throughout.
upgrades: completely separate state and API based steps

These 2 types of steps are now defined in separate lists. This makes
the package even simpler and allows further simplification.
upgrades: iterator refactoring

Moved iterator to operations.go (more appropriate place), made name
shorter and added convenience constructors.
Merge pull request #1090 from wallyworld/unit-public-address-ec2

Unit public address ec2

Fixes: https://bugs.launchpad.net/bugs/1308374

The EC2 provider waits for the instance to advertise its DNS name, and when it does, it inserts this as a public address against the machine. 
The unit's get public address method looks at the slice of machine addresses recorded and picks the first public one. If the DNS name is available before the first public IP address is recorded, this will be printed as the public address. So you sometimes get an IP address, sometimes a DNS name.

People want to get just IP addresses for unit's public/private addresses. So the EC2 provider recording of DNS name has been removed. This means that the juju status dns-name value will show an ip address, but that's what happens for HP Cloud and some other providers anyway, and we also want to get rid of dns-name. 

Also a drive by fix for a go vet issue.
Merge pull request #1052 from mjs/separate-upgrade-steps

Separate upgrade steps that operate on State from those that using the API

The PR separates upgrade steps that manipulate State from those that use the API. All State-using upgrade steps (typically DB migrations) are now run first, before all API-using steps. It is important that DB migrations and the like are run first as later upgrade steps often rely on them having already run. The previous way of defining upgrade steps made it too easy for this not to happen.

API-using steps are now given a context that only allows access to the API and similarly State-using steps can now only access State.

The messages for each commit follow.

---

upgrades: moved Step and Context to their own files

In preparation for upcoming changes where State requiring upgrade steps will be separated from API requiring ones.

Also removed unused "db" and "runner" fields from upgradeContext.

---

upgrades: introduce StateStep

It's now part of the Operation interface, but not used yet.

--- 

upgrades: StateSteps are now run as part of upgrades

All StateStep upgrade steps for a target are now run before other upgrade steps. Existing migration steps still need to be migrated and there's a number of cleanup steps required before this work can be considered done.

--- 

upgrades: migrated steps that manipulate state directly to be defined as such

--- 

upgrades: introduced APIContext

This is a limited upgrade context give to upgrade steps that use only the API. Existing steps like that have been updated to take APIContext instead of Context.

--- 

upgrades: test refactoring

Extracted the common parts of mockStateUpgradeStep and mockUpgradeStep, making the targets() helper unnecessary in the process.
state: fixes LP #1391046

The godoc for state.mergeIds states they come from a map, and are then passed through a set, so there is no guarentee of ordering. Adjust the test to match reality.