From c7f7bd60508b40d6de7ffa3bcf4f5ee789d955ef Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Tue, 24 Jan 2023 20:06:16 +0100 Subject: [PATCH] [PR #5822/fe520a6b backport][stable-6] Gem: Support force flag when uninstalling (#5884) Gem: Support force flag when uninstalling (#5822) * Gem: Support force flag when uninstalling * Improve docs' syntax * Add changelog fragment (cherry picked from commit fe520a6b09aeab283f1477556b49cb64386a8e10) Co-authored-by: Juan Vela --- changelogs/fragments/5822-gem-uninstall-force.yml | 2 ++ plugins/modules/gem.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/5822-gem-uninstall-force.yml diff --git a/changelogs/fragments/5822-gem-uninstall-force.yml b/changelogs/fragments/5822-gem-uninstall-force.yml new file mode 100644 index 0000000000..7b8a0efbda --- /dev/null +++ b/changelogs/fragments/5822-gem-uninstall-force.yml @@ -0,0 +1,2 @@ +bugfixes: + - gem - fix force parameter not being passed to gem command when uninstalling (https://github.com/ansible-collections/community.general/pull/5822). diff --git a/plugins/modules/gem.py b/plugins/modules/gem.py index 21e9efea58..a44683c786 100644 --- a/plugins/modules/gem.py +++ b/plugins/modules/gem.py @@ -105,7 +105,7 @@ options: required: false force: description: - - Force gem to install, bypassing dependency checks. + - Force gem to (un-)install, bypassing dependency checks. required: false default: false type: bool @@ -235,6 +235,8 @@ def uninstall(module): else: cmd.append('--all') cmd.append('--executable') + if module.params['force']: + cmd.append('--force') cmd.append(module.params['name']) module.run_command(cmd, environ_update=environ, check_rc=True)