From 7446da03e8390f16b95cf10acaf75af453d89d46 Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Wed, 18 Sep 2024 10:59:22 +0100 Subject: [PATCH] Fix checksum parsing for Cirros and Rocky Linux For Rocky Linux, the checksum file format differs from Ubuntu. The current awk expression failed to extract the correct checksum and would instead output SHA256. This caused checksum validation to fail. A similar issue exists for CirrOS which uses the MD5 algorithm. Changes the logic to first extract the line with the corresponding image name and then searches for a string that looks like a checksum within that line. Closes-Bug: #2081031 Change-Id: Id426db0ad418898a2ebe9f2b5001945520dc6b1d --- .../tasks/download_deployment_image.yml | 6 +++++- .../notes/fixes-checksum-parsing-82c04ff1bb575c51.yaml | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fixes-checksum-parsing-82c04ff1bb575c51.yaml diff --git a/playbooks/roles/bifrost-ironic-install/tasks/download_deployment_image.yml b/playbooks/roles/bifrost-ironic-install/tasks/download_deployment_image.yml index 449694c42..1aad4a2b0 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/download_deployment_image.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/download_deployment_image.yml @@ -27,7 +27,11 @@ mode: "0644" - name: "Extract deployment image checksum" - command: awk '/{{ deploy_image_upstream_url | basename }}|^[a-z0-9]+$/{print $1}' {{ http_boot_folder }}/{{ deploy_image_filename }}-checksum.CHECKSUMS + shell: + cmd: | + set -o pipefail + grep "{{ deploy_image_upstream_url | basename }}" {{ http_boot_folder }}/{{ deploy_image_filename }}-checksum.CHECKSUMS | grep -owE "[[:xdigit:]]{32,64}" + executable: /bin/bash register: parsed_deployment_image_checksum failed_when: parsed_deployment_image_checksum is failed or not parsed_deployment_image_checksum.stdout diff --git a/releasenotes/notes/fixes-checksum-parsing-82c04ff1bb575c51.yaml b/releasenotes/notes/fixes-checksum-parsing-82c04ff1bb575c51.yaml new file mode 100644 index 000000000..3a0d05926 --- /dev/null +++ b/releasenotes/notes/fixes-checksum-parsing-82c04ff1bb575c51.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes an issue with checksum verification when setting + ``upstream_deploy_image_distribution`` to ``rocky`` or + ``cirros``.