Truncate last_metadata file dumped by cfn-init hook

This patch truncates JSON-dumped metadata file (the default path
should be "/var/cache/heat-cfntools/last_metadata") by cfn-init hook,
and makes sure the file content includes proper metadata only.

Change-Id: I313cc63012134e10165f6bfe09b1096a3cb92cc1
Closes-Bug: #1391072
Merge "Truncate last_metadata file dumped by cfn-init hook"