diff options
author | Abhijeet Kasurde <akasurde@redhat.com> | 2018-01-09 16:58:55 +0530 |
---|---|---|
committer | Martin Krizek <martin.krizek@gmail.com> | 2018-01-09 12:28:55 +0100 |
commit | b14c8b130fa16ce75704bf784bdf7264c43dbaaa (patch) | |
tree | 13e419ff470ca8eb34751dfdd3c86fa48691dd02 /test/integration/targets/yum | |
parent | 9c7d9873957dac46090cf36006c495a810ebf5b7 (diff) | |
download | ansible-b14c8b130fa16ce75704bf784bdf7264c43dbaaa.tar.gz |
yum: handle exception in local_envra (#34400)
This fix adds rpm.error exception which is raised when
API unable to get envra information from RPM package.
Also, adds integration test for local_envra method.
Fixes: #30074
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Diffstat (limited to 'test/integration/targets/yum')
-rw-r--r-- | test/integration/targets/yum/tasks/yum.yml | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/integration/targets/yum/tasks/yum.yml b/test/integration/targets/yum/tasks/yum.yml index 9c09638bbc..224e299230 100644 --- a/test/integration/targets/yum/tasks/yum.yml +++ b/test/integration/targets/yum/tasks/yum.yml @@ -557,3 +557,27 @@ - "'msg' in yum_result" - "'rc' in yum_result" - "'results' in yum_result" + +- name: Create a temp RPM file which does not contain nevra information + file: + name: "/tmp/non_existent_pkg.rpm" + state: touch + +- name: Try installing RPM file which does not contain nevra information + yum: + name: "/tmp/non_existent_pkg.rpm" + state: present + register: no_nevra_info_result + ignore_errors: yes + +- name: Verify RPM failed to install + assert: + that: + - "'changed' in no_nevra_info_result" + - "'msg' in no_nevra_info_result" + - "'Failed to get nevra information from RPM package' in no_nevra_info_result.msg" + +- name: Delete a temp RPM file + file: + name: "/tmp/non_existent_pkg.rpm" + state: absent |