From ae089aefad906701d14cd910cbf2667dddb77715 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 08:06:46 +0200 Subject: [PATCH] [PR #11688/85685944 backport][stable-12] flatpak: fix removal of runtimes (#11713) flatpak: fix removal of runtimes (#11688) * flatpak: fix removal of runtimes (issue #553) The module was using `--app` when listing installed flatpaks for name matching, which excluded runtimes from the results. This caused removal of runtimes to fail even though `flatpak_exists()` correctly detected them as installed (it lists both apps and runtimes). Fix by dropping `--app` from the three matching functions so that both apps and runtimes are searchable. * flatpak: add changelog fragment for PR #11688 --------- (cherry picked from commit 8568594453767cd8f8c5b79aa746a109c828b13f) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 --- changelogs/fragments/11688-flatpak-fix-runtime-removal.yml | 5 +++++ plugins/modules/flatpak.py | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/11688-flatpak-fix-runtime-removal.yml diff --git a/changelogs/fragments/11688-flatpak-fix-runtime-removal.yml b/changelogs/fragments/11688-flatpak-fix-runtime-removal.yml new file mode 100644 index 0000000000..53d0cba56a --- /dev/null +++ b/changelogs/fragments/11688-flatpak-fix-runtime-removal.yml @@ -0,0 +1,5 @@ +bugfixes: + - flatpak - fix removal of runtimes, which was broken because the module was filtering + the installed flatpak list to apps only, so runtimes could never be matched for + uninstallation (https://github.com/ansible-collections/community.general/issues/553, + https://github.com/ansible-collections/community.general/pull/11688). diff --git a/plugins/modules/flatpak.py b/plugins/modules/flatpak.py index 9fd96a9aed..e3f9ad2466 100644 --- a/plugins/modules/flatpak.py +++ b/plugins/modules/flatpak.py @@ -261,7 +261,7 @@ def _match_installed_flat_name(module, binary, name, method): global result # pylint: disable=global-variable-not-assigned parsed_name = _parse_flatpak_name(name) # Try running flatpak list with columns feature - command = [binary, "list", f"--{method}", "--app", "--columns=application"] + command = [binary, "list", f"--{method}", "--columns=application"] _flatpak_command(module, False, command, ignore_failure=True) if result["rc"] != 0 and OUTDATED_FLATPAK_VERSION_ERROR_MESSAGE in result["stderr"]: # Probably flatpak before 1.2 @@ -283,7 +283,7 @@ def _match_installed_flat_name(module, binary, name, method): def _match_flat_using_outdated_flatpak_format(module, binary, parsed_name, method): global result # pylint: disable=global-variable-not-assigned - command = [binary, "list", f"--{method}", "--app", "--columns=application"] + command = [binary, "list", f"--{method}", "--columns=application"] output = _flatpak_command(module, False, command) for row in output.split("\n"): if parsed_name.lower() == row.lower(): @@ -292,7 +292,7 @@ def _match_flat_using_outdated_flatpak_format(module, binary, parsed_name, metho def _match_flat_using_flatpak_column_feature(module, binary, parsed_name, method): global result # pylint: disable=global-variable-not-assigned - command = [binary, "list", f"--{method}", "--app"] + command = [binary, "list", f"--{method}"] output = _flatpak_command(module, False, command) for row in output.split("\n"): if parsed_name.lower() in row.lower():