Fixed lp:1397376 - Backported to 1.21

Backport of #1297 to fix http://pad.lv/1397376 for 1.21.
No changes other than adapting the code for 1.21, except
for upgrading juju/testing version used to the latest, so
JSONEquals and YAMLEquals checkers can be used.

Live tested on EC2, Canonistack, Local, MAAS.

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