diff --git a/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/__init__.py b/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/__init__.py index 4c883634..1fad69a1 100644 --- a/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/__init__.py +++ b/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/__init__.py @@ -19,7 +19,7 @@ from testflinger_device_connectors.devices import ProvisioningError from testflinger_device_connectors.devices.zapper_iot.parser import ( validate_provision_plan, - validate_url, + validate_urls, ) logger = logging.getLogger(__name__) @@ -44,9 +44,11 @@ def _validate_configuration( raise ProvisioningError from e try: - url = self.job_data["provision_data"]["url"] - validate_url(url) + urls = self.job_data["provision_data"]["urls"] + validate_urls(urls) except KeyError: - url = [] + urls = [] + except ValueError as e: + raise ProvisioningError from e - return ((provision_plan, url), {}) + return ((provision_plan, urls), {}) diff --git a/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/parser.py b/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/parser.py index 59024bd4..1c09b509 100644 --- a/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/parser.py +++ b/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/parser.py @@ -202,11 +202,13 @@ def validate_provision_plan(data): validate(instance=data, schema=TPLAN_SCHEMA) logger.info("the JSON data is valid") except jsonschema.exceptions.ValidationError as err: + logger.info("the JSON data is invalid") raise ValueError("the JSON data is invalid") from err -def validate_url(url): +def validate_urls(urls): """for verify url""" - for link in url: + for link in urls: if not validators.url(link): + logger.info("url %s is invalid", link) raise ValueError("url format is not correct")