Add a HardwareManager method to erase devices

Add erase_devices method to the HardwareManager class. By default this
method iterates block devices, and calls a new abstract
erase_block_device method for each device. This patch includes a
simple implementation of erase_block_device on the
GenericHardwareManager which attempts to issue an ATA secure erase on
supported devices.

Change-Id: I81da065395b8785f636f1b0a0d60c9f1c045441e
Expose decom.erase_hardware command via API

Expose an async decom.erase_hardware command in the API. Executing
this command simply calls erase_devices on the loaded HardwareManager
implementation.

Change-Id: I238264a4d5903200ad6a30d82b61804c1e3f5916
Tries to advertise valid default IP

During the first heartbeat, the heartbeater asks the agent to check
its advertised address; if the advertised IP is still the default
(None), the agent tries to replace it with the IP of the first network
interface it finds.  If it fails to find either a network interface or
an IP address, the agent raises an exception.

Change-Id: I6d435d39e99ed0ff5c8b4883b6aa0b356f6cb4ae
Closes-Bug: #1309110
Fix test_run_image

This tests an async function, where exceptions will not bubble up
to the caller. So, we need to check the async result's command_status
attribute in order to make sure the call succeeded.

Change-Id: If8c529943acc794252778280a5fadf2c7860eb0d
Merge "Tries to advertise valid default IP"
Fix HardwareManager loading order bug

The agent attempts to sort the HardwareManager implementations found
by stevedore in order of suitability. This patch fixes a bug in the
sorting order that caused the GenericHardwareManager to always be
loaded.

Fixes bug 1327923

Change-Id: I1cc20e5351a704325f0cf41dab205c9164799f6a
(cherry picked from commit 33e8c0dab2dea307a8314c8c366b0c91f9c7c671)
Perform manual error checks instead of set -e

When using set -e, if you have a command fail, even when setting a
variable, it causes the node to fail. I have removed set -e and checked
error state where unexpected everywhere. I also added additional
logging.

Closes-Bug: #1326326
Change-Id: I7d2568c3693b9c486672e4322c7f01622aeba875
(cherry picked from commit d82b8c6bc0bf0131fb4bec6d18920191f68f2b54)
Fix: partitions recently imaged not being detected

When we have just written out a whole disk image, if we do not run
partprobe none of the new partitions show up in blkid, therefore even
images with a built-in configdrive partition will have one created

Change-Id: I6ec98dc237b42bfe94ce79cf84d155332335c9f6
(cherry picked from commit d159aec4f01795726dccc2bc8ccece3655668e2f)