From 6988ea052d07ab170ade0ba10af039b6f0235cc8 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 20:42:57 +0100 Subject: [PATCH] [PR #5705/2b39470a backport][stable-5] opkg: fix issue that force=reinstall would not reinstall an existing package (#5710) opkg: fix issue that force=reinstall would not reinstall an existing package (#5705) * opkg: fix issue that force=reinstall would not reinstall an existing package Signed-off-by: Joerg Hofrichter * changelog fragment Signed-off-by: Joerg Hofrichter (cherry picked from commit 2b39470a774c28e26780e4e2e4cc9b998471da3c) Co-authored-by: joergho <48011876+joergho@users.noreply.github.com> --- changelogs/fragments/5705-opkg-fix-force-reinstall.yml | 2 ++ plugins/modules/packaging/os/opkg.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/5705-opkg-fix-force-reinstall.yml diff --git a/changelogs/fragments/5705-opkg-fix-force-reinstall.yml b/changelogs/fragments/5705-opkg-fix-force-reinstall.yml new file mode 100644 index 0000000000..27a188ab9e --- /dev/null +++ b/changelogs/fragments/5705-opkg-fix-force-reinstall.yml @@ -0,0 +1,2 @@ +bugfixes: + - opkg - fix issue that ``force=reinstall`` would not reinstall an existing package (https://github.com/ansible-collections/community.general/pull/5705). diff --git a/plugins/modules/packaging/os/opkg.py b/plugins/modules/packaging/os/opkg.py index 60d2adc958..6c5e23093e 100644 --- a/plugins/modules/packaging/os/opkg.py +++ b/plugins/modules/packaging/os/opkg.py @@ -154,7 +154,7 @@ def install_packages(module, opkg_path, packages): install_c = 0 for package in packages: - if query_package(module, opkg_path, package): + if query_package(module, opkg_path, package) and (force != '--force-reinstall'): continue rc, out, err = module.run_command("%s install %s %s" % (opkg_path, force, package))