1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-22 05:09:12 +00:00

[PR #10689/cc41d9da backport][stable-11] gem: fix soundness issue when uninstalling default gems on Ubuntu (#10878)

gem: fix soundness issue when uninstalling default gems on Ubuntu (#10689)

* Attempt to fix gem soundness issue

* Return command execution

* Fix value error

* Attempt to fix failling tests

* Fix minor issues

* Update changelog

* Update tests/integration/targets/gem/tasks/main.yml



* Update changelogs/fragments/10689-gem-prevent-soundness-issue.yml



* Remove state and name from gem error message

* Improve gem uninstall check

* Make unit tests pass

* Fix linting issues

* gem: Remove length chenck and adapt unit tests

* Adapt gem unit tests

* gem: improve error msg

* Fix sanity error

* Fix linting issue

---------


(cherry picked from commit cc41d9da60)

Co-authored-by: Giorgos Drosos <56369797+gdrosos@users.noreply.github.com>
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2025-10-05 07:23:48 +02:00 committed by GitHub
parent 5af8d6132d
commit 90850b3763
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 38 additions and 8 deletions

View file

@ -212,3 +212,18 @@
that:
- install_gem_result is changed
- not gem_bindir_stat.stat.exists
- name: Attempt to uninstall default gem 'json'
community.general.gem:
name: json
state: absent
when: ansible_distribution == "Ubuntu"
register: gem_result
ignore_errors: true
- name: Assert gem uninstall failed as expected
when: ansible_distribution == "Ubuntu"
assert:
that:
- gem_result is failed
- gem_result.msg.startswith("Failed to uninstall gem 'json'")