command = ["/usr/bin/wget", "-r", "-l1", "-np", "-nd", "-q", "-A",
os.getenv("TESTABLE_IMAGE_DOWNLOADABLES"), url]
subprocess.check_output(command)
- image = glob.glob(os.getenv("TESTABLE_IMAGE_FILTER"))[0]
+ image = glob.glob("*.bz2")[0]
logging.info("Image retrieved successfully.")
return image
except (IndexError, ValueError, subprocess.CalledProcessError,
"Error: {0}".format(error))
except (ValueError, subprocess.CalledProcessError) as error:
result = "FAIL"
- logging.error("Either the device didn't boot." +
- "Error: {0}".format(error))
+ logging.critical("The device is not reachable." +
+ "Error: {0}".format(error))
else:
result = "PASS"
logging.info("The device can boot and all the tests were run." +
"""
Store results to file and trigger publishing job.
"""
+ logging.info("Packing results and triggering next job.")
with open("Results.ENV", "w") as results:
results.write("TEST_RESULT=" + fields["test_result"] + "\n")
results.write("IMAGE=" + image + "\n")
fields = trigger_info(os.getenv("TRIGGER_INFO"))
try:
- file_name = ET.fromstring(fields["image_xml"])\
- .find("storage").find("disk").get("file")
+ file_name = ""
+ xml = ET.fromstring(fields["image_xml"])
+ logging.info("Extracted xml from environment {0}".format(xml))
+ storage = xml.find("storage")
+ logging.info("Storage {0}".format(storage))
+ disk = storage.find("disk")
+ logging.info("Disk {0}".format(disk))
+ file_name = disk.get("file")
logging.info("Image to test: {0}".format(file_name))
- except AttributeError as e:
- logging.error("Error: {0}".format(e))
+ except AttributeError as error:
+ logging.critical("Error: {0}".format(error))
fields["test_result"] = "PARAMETERS_ERRORS"
- propagate_results(image="", fields=fields);
+ propagate_results(image=file_name, fields=fields)
return 0
if not image_supported(file_name):
logging.info("Image not supported by the tester.")
fields["test_result"] = "IMAGE_NOT_SUPPORTED"
- propagate_results(image="", fields=fields)
+ propagate_results(image=file_name, fields=fields)
return 0
image = fetch_image(fields["url"])
- if image == "":
+ if image is "":
fields["test_result"] = "IMAGE_NOT_FOUND"
- propagate_results(image="", fields=fields)
+ propagate_results(image=file_name, fields=fields)
return 0
fields["test_result"] = test_image(image)
- propagate_results(image=image, fields=fields)
+ propagate_results(image=file_name, fields=fields)
return 0