Skip to content

Commit

Permalink
Merge pull request #579 from redhatci/no_handlers
Browse files Browse the repository at this point in the history
Do not use handlers to remove files
  • Loading branch information
tonyskapunk authored Feb 26, 2025
2 parents 5f595f3 + 62cd2b7 commit 357d581
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 44 deletions.
6 changes: 0 additions & 6 deletions roles/acm_hypershift/handlers/main.yml

This file was deleted.

7 changes: 6 additions & 1 deletion roles/acm_hypershift/tasks/create-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@
{% if ah_control_plane_availability_policy is defined %}
--control-plane-availability-policy="{{ ah_control_plane_availability_policy }}"
{% endif %}
notify: Remove working directory
changed_when: false

- name: Remove working directory
ansible.builtin.file:
path: "{{ hs_tmp_dir.path }}"
state: absent
when: hs_tmp_dir is defined

- name: Wait for Hosted Cluster initialization
ansible.builtin.pause:
seconds: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@
ansible.builtin.file:
state: absent
path: "{{ cv_tool_dir.path }}"
when:
- cv_tool_dir is defined
- cv_tool_dir.path is defined

- name: "Delete work_dir directory"
ansible.builtin.file:
state: absent
path: "{{ work_dir }}"
listen: "helm-chart-verifier cleanup"
path: "{{ tmp_dir.path }}"
when:
- tmp_dir
- tmp_dir.path is defined

- name: "Delete the one time use key from Github"
ansible.builtin.command: "{{ gh_tool_path }} api -X DELETE user/keys/{{ key_id }}"
ignore_errors: true
listen: "helm-chart-verifier cleanup"

- name: "GH logout"
ansible.builtin.command: "{{ gh_tool_path }} auth logout --hostname github.com"
listen: "helm-chart-verifier cleanup"
failed_when: false
...
3 changes: 3 additions & 0 deletions roles/chart_verifier/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@
loop_control:
loop_var: chart
index_var: index

- name: Cleanup tasks
ansible.builtin.include_tasks: cleanup.yml
...
2 changes: 0 additions & 2 deletions roles/chart_verifier/tasks/mirror-chart-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
loop_var: chart
label: "{{ chart.chart_file | basename }}"
register: chart_images
notify:
- "Delete tmp tool directory"

- name: "Get all images"
ansible.builtin.set_fact:
Expand Down
2 changes: 0 additions & 2 deletions roles/chart_verifier/tasks/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,4 @@
when:
- pr_details is defined
- pr_details.rc == 0
notify:
- "helm-chart-verifier cleanup"
...
6 changes: 0 additions & 6 deletions roles/fbc_catalog/handlers/main.yml

This file was deleted.

7 changes: 5 additions & 2 deletions roles/fbc_catalog/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@
-t {{ fbc_index_image }}
args:
chdir: "{{ fbc_tmp_dir }}"
notify:
- "Delete temp directory"

- name: "Delete temp directory"
ansible.builtin.file:
state: absent
path: "{{ fbc_tmp_dir }}"

- name: "Display fbc_index_image"
ansible.builtin.debug:
Expand Down
6 changes: 0 additions & 6 deletions roles/mirror_catalog/handlers/main.yml

This file was deleted.

9 changes: 7 additions & 2 deletions roles/mirror_catalog/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,10 @@
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_gid }}"
mode: "0644"
notify:
- "Delete tmp directory"

- name: Delete tmp directory
ansible.builtin.file:
path: "{{ mc_tmp.path }}"
state: absent
when: mc_tmp is defined
...
6 changes: 0 additions & 6 deletions roles/opcap_tool/handlers/main.yml

This file was deleted.

7 changes: 5 additions & 2 deletions roles/opcap_tool/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
dest: "{{ opcap_output_dir }}/{{ opcap_target_catalog_source }}_install_report.json"
mode: "0644"
when: opcap_check.stdout != ""
notify:
- "Remove opcap dir"

- name: "Remove opcap dir"
ansible.builtin.file:
path: "{{ opcap_dir.path }}"
state: absent
...
4 changes: 0 additions & 4 deletions roles/setup_gitea/handlers/main.yml

This file was deleted.

5 changes: 5 additions & 0 deletions roles/setup_gitea/tasks/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@
retries: 10
delay: 5
until: _sg_gitea_namespace.resources | length == 0

- name: Clear mirror temp dir
ansible.builtin.file:
path: "{{ _sg_mirror_repo.path }}"
state: absent
...
1 change: 0 additions & 1 deletion roles/setup_gitea/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@
state: directory
prefix: setup_gitea
register: _sg_mirror_repo
notify: Clear mirror temp dir

- name: Clone reference repository
# Use sshkey file when provided, otherwise omit it in the module
Expand Down

0 comments on commit 357d581

Please sign in to comment.