cloudinit: export AddBootTextFile

This will be needed by the Joyent provider.
provider/joyent: add a static route for the internal network

Fixes LP #1401130.
Merge pull request #1317 from mjs/1401130-joyent-routing

provider/joyent: add a static route for the internal network

Fixes LP #1401130

No unit tests yet because it appears the local/fake Joyent API doesn't save machine metadata. I'll fix this and add a test in a later PR. 

This change works in a real environment though.

(Review request: http://reviews.vapour.ws/r/633/)
Fixed lp:1397376 - api-endpoints behaves as expected
Merge pull request #1297 from dimitern/lp-1397376-public-ips-before-hostnames

Fixed lp:1397376 - api-endpoints behaves as expected

This fixes http://pad.lv/1397376/ by changing how API
server addresses are handled by the CLI/API clients.

Major changes:
 * cmd/juju: api-endpoints - added help text, added --all argument,
 vastly improved tests.
 * network.SortAddresses and network.SortHostPorts changed to apply
 consistent ordering with regards to scope and prefer-ipv6 flag);
 * network.ResolveOrDropHostnames introduced;
 * network package refactored to split relevent entities in their own files/suites;
 * dropped obsolete stuff like most of what's related to network.Port.
 * cmd/juju: bootstrap command - endpoints caching post-bootstrap fixed;
 * juju/api: changed the way API endpoints are cached in the .jenv file.
 * environs/configstore: added APIEndpoint.Hostnames - optional list
 of cached API hostnames/IPs (before resolving), so DNS resolution
 won't be needed if hostnames haven't changed.
 * Added *lots* of extra tests for all changes.

What's changed? Before caching the API endpoints for use by the CLI (either just
 after bootstrap or with api-endpoints --refresh):
 - All known endpoints are sorted in the following order:
 -- public addresses
 -- hostnames (only localhost as the others are resolved, see below)
 -- cloud-local addresses
 -- link-local addresses (which are then filtered out as unusable)
 -- machine-local addresses
 - Then any hostnames, except localhost (because of the local provider
 and also dummy provider to simplify testing), are resolved using the
 local resolver and (if successful) inserted in the same order in the
 list of endpoints. Unresolvable hostnames are dropped. This means the
 .jenv file won't contain any hostnames (except for maybe localhost), as
 this seems to be the expected behavior - scripts prefer IPs, not hosts.
 - Any duplicates are removed.
 - prefer-ipv6 flag is respected (i.e. when true IPv6 addresses of the
 same scope come before IPv4 ones).
 - The last endpoint used to successfully connect to the API server is
 inserted at the top of the list.

Minor changes:
 * network.Address, HostPort, Port, PortRange now all have String() and
 GoString() methods; tests improved.
 * envtesting.PatchAttemptStrategies() changed to include the (now exported)
 AddressesRefreshAttempt used while waiting for bootstrap instance addresses.
 * A few changes to log messages to fix typos or improve
 readability (easier to test/debug some deeply nested operations).

RB link: http://reviews.vapour.ws/r/611/
cmd/juju: don't use JobManageNetworking with servers that don't support it

This fixes LP #1402826.
Merge pull request #1319 from mjs/1402826-jobmanagenetworking-compat

cmd/juju: don't use JobManageNetworking with servers that don't support it

This fixes LP #1402826.

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