Fix bug that breaks delete test case in UBI BMC code update

Resolves openbmc/openbmc-test-automation#968

Change-Id: I73966a9fe50293111749db042bf9885fec611980
Signed-off-by: Charles Paul Hofer <Charles.Hofer@ibm.com>
diff --git a/lib/code_update_utils.py b/lib/code_update_utils.py
index dd1cdc3..6b6254b 100644
--- a/lib/code_update_utils.py
+++ b/lib/code_update_utils.py
@@ -65,7 +65,8 @@
     for image_name in images:
         _, image_properties = keyword.run_key(
                 "Get Host Software Property  " + image_name)
-        if image_properties['Purpose'] != var.VERSION_PURPOSE_HOST \
+        if 'Purpose' in image_properties and 'Version' in image_properties \
+                and image_properties['Purpose'] != var.VERSION_PURPOSE_HOST \
                 and image_properties['Version'] != cur_img_version:
             return image_name
     BuiltIn().fail("Did not find any non-running BMC images.")