Allow heat tests to use already uploaded test image

If $HEAT_FETCHED_TEST_IMAGE is set then tempest is configured to
use the image named $HEAT_FETCHED_TEST_IMAGE for any orchestration
tests which require an image.

Fallback to checking $HEAT_CREATE_TEST_IMAGE and invoking
diskimage-builder if necessary.

The intent is to use Fedora 20 as the test image for gating
since this image has heat-cfntools already installed.

Change-Id: I177ae091a641ba99fd4c618e30a39c5148ae617f
diff --git a/lib/tempest b/lib/tempest
index 803b740..d2e3b0a 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -281,7 +281,9 @@
     iniset $TEMPEST_CONF boto ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
 
     # Orchestration test image
-    if [[ "$HEAT_CREATE_TEST_IMAGE" = "True" ]]; then
+    if [[ ! -z "$HEAT_FETCHED_TEST_IMAGE" ]]; then
+        iniset $TEMPEST_CONF orchestration image_ref "$HEAT_FETCHED_TEST_IMAGE"
+    elif [[ "$HEAT_CREATE_TEST_IMAGE" = "True" ]]; then
         disk_image_create /usr/share/tripleo-image-elements "vm fedora heat-cfntools" "i386" "fedora-vm-heat-cfntools-tempest"
         iniset $TEMPEST_CONF orchestration image_ref "fedora-vm-heat-cfntools-tempest"
     fi