Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for file retrival, use random file names #511

Merged
merged 6 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion roles/validate_http_store/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
http_store_dir : "{{ iso_download_dest_path | default('/opt/http_store/data') }}"
http_port: 80
http_host: "{{ discovery_iso_server | default('http://' + hostvars['http_store']['ansible_host']) }}:{{ http_port }}"
test_file_name: http_test
...
14 changes: 11 additions & 3 deletions roles/validate_http_store/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
---
- name: Set a random name for the test file
ansible.builtin.set_fact:
vhs_test_file_name: "{{ lookup('password', '/dev/null length=12 chars=ascii_letters,digits') }}"
betoredhat marked this conversation as resolved.
Show resolved Hide resolved

- name: Set test file contents
set_fact:
contents: "{{ lookup('template', 'test_file.j2') }}"

- name: Copy file to http_store
copy:
content: "{{ contents }}"
dest: "{{ http_store_dir }}/{{ test_file_name }}"
dest: "{{ http_store_dir }}/{{ vhs_test_file_name }}"
mode: 0644
setype: httpd_sys_content_t
become: true
delegate_to: http_store

- name: Retrieve file from http_store
uri:
url: "{{ http_host }}/{{ test_file_name }}"
url: "{{ http_host }}/{{ vhs_test_file_name }}"
return_content: true
register: response
delegate_to: bastion
retries: 12
delay: 5
until: response.status == 200

- name: Check content matches
assert:
Expand All @@ -26,7 +34,7 @@

- name: Remove file on http_store
file:
path: "{{ http_store_dir }}/{{ test_file_name }}"
path: "{{ http_store_dir }}/{{ vhs_test_file_name }}"
state: absent
become: true
delegate_to: http_store
Loading