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
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
Use processutils properly

Previously this code was calling processutils.execute incorrectly,
expecting it to return the exit code. This change:

* fixes calls to processutils.execute
* fixes related tests

Change-Id: I3343f104a5a8200d53bd87a8799ff918e375b17f
Fix incorrect log statement

Logging statement says it's 'imaging' to RAW, when in reality it's a
conversion.

Change-Id: I80d112062f51a6ccc932aeb71ec05042edb09884
Merge "Perform manual error checks instead of set -e"
Remove duplicated test for caching image

The test test_cache_image_success is (bad) duplicate of the
test test_cache_image

The test is trying to retrieve a real url and saving it into
a block device. Mock several calls to avoid this behavior and
and assert that the cached image is properly saved.

Change-Id: Ie2ff5931cc77e5cdd1621c652d73a62fed0b69a6
Partial-Bug: #1326849
Improve cache_image testing

Add tests around cache_image functionality to cover other cases:
- A image is already cached
- A image is already cached but we use the parameter force to refresh it.

Change-Id: I9739c2e0d29091d29fa170cf04d953184b8cb54d
Partial-Bug: #1326849
Merge "Use processutils properly"
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
Merge "Fix HardwareManager loading order bug"
Reduce requests connection pool size

Requests defaults to keeping 10 connections to the API alive. This
seems excessive, reduce it to 2.

Change-Id: Iac67fd4d855388d2671da3b7258b31d1eead77a9
Merge "Fix: partitions recently imaged not being detected"
Merge "Reduce requests connection pool size"
Merge "Remove duplicated test for caching image"
Merge "Improve cache_image testing"
Fix invalid command in Dockerfile

This cleanup command was invalid. Not removing the apt lists adds a few
unneeded megabytes to the agent image.

Change-Id: I55ad4434d20a8984ea4cf5866360fd2622d811f4
Fix comments to reflect reality

These comments were left in write_image.sh from the 'teeth-agent' days
when these were split into two scripts. I moved the comment into the
correct script and clarified what it means.

Change-Id: Iccdcd925be5c94d993d8125534264f496de4594f
Improve readme for CoreOS imagebuild

This:
  - includes a link to new gate-built images
  - updates the kernel command line options (none needed in newer
    images)

Change-Id: I79e9a0ab7de1dc61dd035bebf81c87136e4c3202
Merge "Improve readme for CoreOS imagebuild"
Better errors for execute() failures

Exceptions raised due to processutils.execute() failing now include
stdout and stderr.

Change-Id: Id5d1b5bc51d377f9f3c338cd7303ea800f76e5cd