mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07: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:
parent
9c7d987395
commit
b14c8b130f
2 changed files with 34 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue