Skip to content

Commit 5d0e82a

Browse files
Mauricio Harleydanpawlik
authored andcommitted
Add validation for HSM password availability
Add early validation to fail with a descriptive error message when the HSM password (cifmw_hsm_password) is neither defined as a variable nor available in the Zuul secrets file. This addresses the scenario where both conditions are unmet: - cifmw_hsm_password is not defined in the job configuration - The secrets file /var/tmp/qe-secrets/proteccio_pin.yaml does not exist Previously, this would cause the playbook to continue and fail later with an unhelpful "cifmw_hsm_password is undefined" error. Now it fails early with a clear message explaining the two options to resolve it. Signed-off-by: Mauricio Harley <[email protected]>
1 parent a19d1f7 commit 5d0e82a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

hooks/playbooks/barbican-prepare-proteccio.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424
ansible.builtin.set_fact:
2525
cifmw_hsm_password: "{{ _proteccio_pin_data.rdu2Pin }}"
2626

27+
- name: Fail if HSM password is not available
28+
when: cifmw_hsm_password is not defined
29+
ansible.builtin.fail:
30+
msg: >-
31+
The HSM password (cifmw_hsm_password) is not defined and could not
32+
be loaded from the secrets file at /var/tmp/qe-secrets/proteccio_pin.yaml.
33+
Please ensure either:
34+
1. The variable cifmw_hsm_password is set in your job configuration, or
35+
2. The Zuul secret file exists (created by qe-creds-crc.yaml pre-run playbook)
36+
2737
- name: Check out the role Git repository
2838
ansible.builtin.git:
2939
dest: "./rhoso_proteccio_hsm"

0 commit comments

Comments
 (0)