Skip to content

Commit c0ca9fc

Browse files
slagleevallesp
authored andcommitted
Fix permission denied when checking for cifmw_reproducer_src_dir
The ansible stat module does gracefully handle permission denied, and will instead fail with an error of the patch can't be read due to permissions. Add an ignore_errors: true to the task checking for cifmw_reproducer_src_dir and then verify the stat result is defined before using it. This scenario can occur when ansible_user is not the same user as the one executing ansible-playbook, and since this task is delegated to localhost, most users don't have permission to read other user's home dirs. Jira: OSPRH-19535 Signed-off-by: James Slagle <[email protected]>
1 parent 2a995b7 commit c0ca9fc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

roles/reproducer/tasks/configure_controller.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@
356356
path: "{{ cifmw_reproducer_src_dir }}"
357357
register: cifmw_reproducer_src_dir_stat
358358
run_once: true
359+
ignore_errors: true
359360

360361
- name: Sync local repositories to other hosts if present
361362
delegate_to: localhost
@@ -366,6 +367,7 @@
366367
recursive: true
367368
loop: "{{ groups['controllers'] }}"
368369
when:
370+
- cifmw_reproducer_src_dir_stat.stat is defined
369371
- cifmw_reproducer_src_dir_stat.stat.exists
370372
- cifmw_reproducer_src_dir_stat.stat.isdir
371373

@@ -375,6 +377,7 @@
375377
path: "{{ cifmw_reproducer_src_dir }}/github.com/openstack-k8s-operators/ci-framework/common-requirements.txt"
376378
register: _local_common_requirements_check
377379
run_once: true
380+
ignore_errors: true
378381

379382
- name: Install ansible dependencies
380383
register: _async_dep_install
@@ -383,7 +386,7 @@
383386
ansible.builtin.pip:
384387
requirements: "{{ have_local | ternary(local, remote) }}"
385388
vars:
386-
have_local: "{{ _local_common_requirements_check.stat.exists }}"
389+
have_local: "{{ _local_common_requirements_check.stat is defined and _local_common_requirements_check.stat.exists }}"
387390
local: "{{ cifmw_reproducer_src_dir }}/github.com/openstack-k8s-operators/ci-framework/common-requirements.txt"
388391
remote: https://raw.githubusercontent.com/openstack-k8s-operators/ci-framework/main/common-requirements.txt
389392

0 commit comments

Comments
 (0)