mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-04 20:32:45 +00:00
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:
committed by
Martin Krizek
parent
9c7d987395
commit
b14c8b130f
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user