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>
This commit is contained in:
Abhijeet Kasurde 2018-01-09 16:58:55 +05:30 committed by Martin Krizek
commit b14c8b130f
2 changed files with 34 additions and 0 deletions

View file

@ -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