Skip to content

Commit 29b561f

Browse files
committed
[test-operator] Improve variables overwriting
As part of processing test-operator stages, there is a task that takes all defined Ansible variables and overrides them with matching stage-specific variables. However, this task focuses in the end only on variables specific to test-operator. Yet, because the filtering is done on Ansible task-level, we end up with 80% of the `ansible-post-deployment.log` filled with entries like `skipping <variable_name>`. To make this worse, it exposes some deployment-time secrets as a side-effect. This commit moves the filtering from task-level to earlier phase ~ when the loop arguments are prepared, so we will do override only on the test-operator-related variables, reducing the useless output and avoiding secrets exposure.
1 parent 5f9f0fa commit 29b561f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

roles/test_operator/tasks/stages.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,9 @@
3030
_stage_test_vars: "{{ file_vars | combine(test_vars) }}"
3131

3232
- name: Overwrite global_vars with stage_vars
33-
with_dict: "{{ vars | combine(_stage_test_vars) }}"
34-
vars:
35-
start_with: cifmw_test_operator_
36-
when: item.key.startswith(start_with)
3733
ansible.builtin.set_fact:
3834
stage_vars_dict: "{{ stage_vars_dict | combine({item.key: _stage_test_vars[item.key] | default(lookup('vars', item.key, default=omit)) }) }}"
35+
with_dict: "{{ vars | combine(_stage_test_vars) | dict2items | selectattr('key', 'match', '^cifmw_test_operator_') | items2dict }}"
3936

4037
- name: Override specific type config
4138
vars:

0 commit comments

Comments
 (0)