From ec737762bdd4c393ae4cf08a6fc4aca2bee6e7ec Mon Sep 17 00:00:00 2001 From: Miroslav Vadkerti Date: Apr 26 2019 17:38:17 +0000 Subject: [PATCH 1/2] 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..662e3ee 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 == 0 + + - 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 != 0 - name: Get the specfile package name shell: rpm -q --specfile --queryformat="%{NAME}\n" {{pkgdir}}/*.spec | head -n1 From 6aed2b8db470154e2823968a11edc4b9b1b6e910 Mon Sep 17 00:00:00 2001 From: Miroslav Vadkerti Date: May 03 2019 08:59:11 +0000 Subject: [PATCH 2/2] debug --- diff --git a/roles/standard-test-source/tasks/main.yml b/roles/standard-test-source/tasks/main.yml index 662e3ee..f24b512 100644 --- a/roles/standard-test-source/tasks/main.yml +++ b/roles/standard-test-source/tasks/main.yml @@ -36,6 +36,8 @@ until: result is succeeded when: ansible_user_id == 0 + - debug: var=ansible_user_id + - block: - name: Check if required packages are installed on the system command: rpm -q {{ item }} @@ -44,6 +46,8 @@ with_items: - rpm-build + - debug: var=rpm_result + - fail: msg: "Some of the required packages were not found on the localhost: {{ rpm_result.results[0].stdout }}" when: rpm_result.failed == true