Skip to content

Commit

Permalink
feat(bmc_fw_update): compare version with filename
Browse files Browse the repository at this point in the history
This is instead of comparing before and after version

Fixes #22

Signed-off-by: Boris Glimcher <[email protected]>
  • Loading branch information
glimchb committed Feb 27, 2024
1 parent 4fba278 commit 087ed2b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions roles/bmc_fw_update/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
ansible.builtin.debug:
msg: "{{ bmc_firmware_version }}"

- name: Validate fw image changed from before
ansible.builtin.assert:
that:
- get_bmc_facts_before.redfish_facts.firmware.entries[0].Version != get_bmc_facts_after.redfish_facts.firmware.entries[0].Version
- name: Validate fw image matches given filename
ansible.builtin.fail:
msg: "{{ bmc_fw_update_version_failure }}"
when: not bmc_fw_update_image.bmc is search(bmc_firmware_version | regex_search('[0-9-.]+'))
1 change: 1 addition & 0 deletions roles/bmc_fw_update/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# vars file for bmc_fw_update

bmc_fw_update_task_failure: "Task failed with status: %s"
bmc_fw_update_version_failure: "Version returned from BMC doesn't match version in the file name"
bmc_fw_update_image:
url: https://content.mellanox.com/BlueField/BMC/23.10-1-oct-2023
bmc: bf3-bmc-23.10-5_opn.fwpkg
Expand Down
2 changes: 1 addition & 1 deletion roles/get_bmc_facts/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

- name: Extract BMC firmware version from inventory
ansible.builtin.set_fact:
bmc_firmware_version: "{{ result.redfish_facts.firmware | community.general.json_query('entries[?Id==`BMC_Firmware`].Version') }}"
bmc_firmware_version: "{{ result.redfish_facts.firmware | community.general.json_query('entries[?Id==`BMC_Firmware`].Version') | first }}"

0 comments on commit 087ed2b

Please sign in to comment.