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.
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