From 559d7cadfae0b45491e4283dc35dad474e69f49a Mon Sep 17 00:00:00 2001 From: Miroslav Vadkerti Date: May 12 2019 21:34:35 +0000 Subject: standard-test-source: install rpm-build only as root Without this patch, people running STR against a remote machine without root cannot use this role ... NOTE: This patch is an exception to STI by the OSCI team. All fixes like this need to be approved for inclusion, as they are not compliant to STI. Signed-off-by: Miroslav Vadkerti --- diff --git a/roles/standard-test-source/tasks/main.yml b/roles/standard-test-source/tasks/main.yml index d82bebe..9c5430f 100644 --- a/roles/standard-test-source/tasks/main.yml +++ b/roles/standard-test-source/tasks/main.yml @@ -34,6 +34,21 @@ retries: 5 delay: 10 until: result is succeeded + when: ansible_user_id == 'root' + + - block: + - name: Check if required packages are installed on the system + command: rpm -q {{ item }} + ignore_errors: True + register: rpm_result + with_items: + - rpm-build + + - fail: + msg: "Some of the required packages were not found on the localhost: {{ rpm_result.results[0].stdout }}" + when: rpm_result.failed == true + + when: ansible_user_id != 'root' - name: Get the specfile package name shell: rpm -q --specfile --queryformat="%{NAME}\n" {{pkgdir}}/*.spec | head -n1