diff options
Diffstat (limited to 'mcp/scripts')
-rw-r--r-- | mcp/scripts/lib.sh | 16 | ||||
-rw-r--r-- | mcp/scripts/requirements_deb.yaml | 1 | ||||
-rw-r--r-- | mcp/scripts/requirements_rpm.yaml | 1 |
3 files changed, 17 insertions, 1 deletions
diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh index eb0ad8866..c9159fff6 100644 --- a/mcp/scripts/lib.sh +++ b/mcp/scripts/lib.sh @@ -540,6 +540,9 @@ function do_templates() { PHAROS_GEN_CFG="./pharos/config/utils/generate_config.py" PHAROS_INSTALLER_ADAPTER="./pharos/config/installers/fuel/pod_config.yml.j2" PHAROS_INSTALLER_NETMAP="$(dirname "${PHAROS_INSTALLER_ADAPTER}")/net_map.j2" + PHAROS_VALIDATE_SCHEMA_SCRIPT="./pharos/config/utils/validate_schema.py" + PHAROS_SCHEMA_PDF="./pharos/config/pdf/pod1.schema.yaml" + PHAROS_SCHEMA_IDF="./pharos/config/pdf/idf-pod1.schema.yaml" BASE_CONFIG_PDF="${lab_config_uri}/labs/${target_lab}/${target_pod}.yaml" BASE_CONFIG_IDF="${lab_config_uri}/labs/${target_lab}/idf-${target_pod}.yaml" LOCAL_PDF="${image_dir}/$(basename "${BASE_CONFIG_PDF}")" @@ -555,7 +558,18 @@ function do_templates() { notify_e "[ERROR] Could not retrieve PDF (Pod Descriptor File)!" elif ! curl -o "${LOCAL_IDF}" "${BASE_CONFIG_IDF}"; then notify_e "[ERROR] Could not retrieve IDF (Installer Descriptor File)!" - elif ! "${PHAROS_GEN_CFG}" -y "${LOCAL_PDF}" \ + fi + # Check first if configuration files are valid + if [[ ! "$target_pod" =~ "virtual" ]]; then + if ! "${PHAROS_VALIDATE_SCHEMA_SCRIPT}" -y "${LOCAL_PDF}" \ + -s "${PHAROS_SCHEMA_PDF}"; then + notify_e "[ERROR] PDF does not match yaml schema!\n" 1>&2 + elif ! "${PHAROS_VALIDATE_SCHEMA_SCRIPT}" -y "${LOCAL_IDF}" \ + -s "${PHAROS_SCHEMA_IDF}"; then + notify_e "[ERROR] IDF does not match yaml schema!\n" 1>&2 + fi + fi + if ! "${PHAROS_GEN_CFG}" -y "${LOCAL_PDF}" \ -j "${PHAROS_INSTALLER_ADAPTER}" > "${image_dir}/pod_config.yml"; then notify_e "[ERROR] Could not convert PDF+IDF to reclass model input!" fi diff --git a/mcp/scripts/requirements_deb.yaml b/mcp/scripts/requirements_deb.yaml index e50a48ff8..04ddcf631 100644 --- a/mcp/scripts/requirements_deb.yaml +++ b/mcp/scripts/requirements_deb.yaml @@ -28,6 +28,7 @@ requirements_pkg: - python-ipaddress - python-jinja2 - python-yaml + - python-jsonschema # Optional, arch-specific requirements, matched by key name = $(uname -m) aarch64: # AArch64 VMs use AAVMF (guest UEFI) diff --git a/mcp/scripts/requirements_rpm.yaml b/mcp/scripts/requirements_rpm.yaml index 91f862f9d..3df4d0a80 100644 --- a/mcp/scripts/requirements_rpm.yaml +++ b/mcp/scripts/requirements_rpm.yaml @@ -34,6 +34,7 @@ requirements_pkg: - python-ipaddress - python-jinja2 - python-yaml + - python-jsonschema # Optional, arch-specific requirements, matched by key name = $(uname -m) aarch64: # AArch64 VMs use AAVMF (guest UEFI) |