Package: ansible Version: 2.7.7+dfsg-1 Severity: important Tags: patch Hello,
Note this issue only happens in stable, Buster 10.2 with ansible 2.7.7 When using ansible with flatpak_remote, it breaks. The following snippet: ``` - name: Add the flathub flatpak repository remote to the user installation flatpak_remote: name: flathub state: present flatpakrepo_url: https://dl.flathub.org/repo/flathub.flatpakrepo method: user ``` causes: ``` TASK [Add the flathub flatpak repository remote to the user installation] ***************************************************** fatal: [127.0.0.1]: FAILED! => {"changed": false, "module_stderr": "/home/zumbi/.ansible/tmp/ansible-tmp-1581109559.271161-112064566806002/AnsiballZ_flatpak_remote.py:17: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses\n import imp\nTraceback (most recent call last):\n File \"/home/zumbi/.ansible/tmp/ansible-tmp-1581109559.271161-112064566806002/AnsiballZ_flatpak_remote.py\", line 113, in <module>\n _ansiballz_main()\n File \"/home/zumbi/.ansible/tmp/ansible-tmp-1581109559.271161-112064566806002/AnsiballZ_flatpak_remote.py\", line 105, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/zumbi/.ansible/tmp/ansible-tmp-1581109559.271161-112064566806002/AnsiballZ_flatpak_remote.py\", line 48, in invoke_module\n imp.load_module('__main__', mod, module, MOD_DESC)\n File \"/usr/lib/python3.7/imp.py\", line 234, in load_module\n return load_source(name, filename, file)\n File \"/usr/lib/python3.7/imp.py\", line 169, in load_source\n module = _exec(spec, sys.modules[name])\n File \"<frozen importlib._bootstrap>\", line 630, in _exec\n File \"<frozen importlib._bootstrap_external>\", line 728, in exec_module\n File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n File \"/tmp/ansible_flatpak_remote_payload_3i68y3ku/__main__.py\", line 241, in <module>\n File \"/tmp/ansible_flatpak_remote_payload_3i68y3ku/__main__.py\", line 230, in main\n File \"/tmp/ansible_flatpak_remote_payload_3i68y3ku/__main__.py\", line 172, in remote_exists\nIndexError: list index out of range\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1} to retry, use: --limit @/home/zumbi/SCM/GITAuth/local/ansible/playbook.retry ``` The issue has been reported upstream at: https://github.com/ansible/ansible/issues/51481 And a pull request has been merged: https://github.com/ansible/ansible/pull/54103 I am attaching a debdiff I have tested and fixes the issue above. Please, consider fixing this issue in Buster, via stable-updates. If you need help, please let me know, I am willing to proceed with the upload if you wish. Regards -- System Information: Debian Release: 10.2 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 4.19.0-6-amd64 (SMP w/8 CPU cores) Kernel taint flags: TAINT_USER Locale: LANG=ca_ES.UTF-8, LC_CTYPE=ca_ES.UTF-8 (charmap=UTF-8), LANGUAGE=ca_ES:ca (charmap=UTF-8) Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages ansible depends on: ii python3 3.7.3-1 ii python3-crypto 2.6.1-9+b1 ii python3-cryptography 2.6.1-3+deb10u2 ii python3-httplib2 0.11.3-2 ii python3-jinja2 2.10-2 ii python3-netaddr 0.7.19-1 ii python3-paramiko 2.4.2-0.1 ii python3-pkg-resources 40.8.0-1 ii python3-yaml 3.13-2 Versions of packages ansible recommends: ii python3-jmespath 0.9.4-1 ii python3-kerberos 1.1.14-2 ii python3-libcloud 2.4.0-1 ii python3-selinux 2.8-1+b1 ii python3-winrm 0.3.0-2 ii python3-xmltodict 0.11.0-2 Versions of packages ansible suggests: pn cowsay <none> pn sshpass <none> -- no debconf information
diff -Nru ansible-2.7.7+dfsg/debian/changelog ansible-2.7.7+dfsg/debian/changelog --- ansible-2.7.7+dfsg/debian/changelog 2019-02-21 08:44:57.000000000 +0100 +++ ansible-2.7.7+dfsg/debian/changelog 2020-02-07 22:07:29.000000000 +0100 @@ -1,3 +1,12 @@ +ansible (2.7.7+dfsg-1local1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Local test of upstream patch to fix flatpak module: + https://github.com/ansible/ansible/issues/51481 + https://github.com/ansible/ansible/pull/54103 + + -- Hector <zu...@shifu.oron.es> Fri, 07 Feb 2020 22:07:29 +0100 + ansible (2.7.7+dfsg-1) unstable; urgency=high * New upstream release diff -Nru ansible-2.7.7+dfsg/debian/patches/d78b3424dd9e72132df9b52ee4e5422cd3094bd6.patch ansible-2.7.7+dfsg/debian/patches/d78b3424dd9e72132df9b52ee4e5422cd3094bd6.patch --- ansible-2.7.7+dfsg/debian/patches/d78b3424dd9e72132df9b52ee4e5422cd3094bd6.patch 1970-01-01 01:00:00.000000000 +0100 +++ ansible-2.7.7+dfsg/debian/patches/d78b3424dd9e72132df9b52ee4e5422cd3094bd6.patch 2020-02-07 22:07:29.000000000 +0100 @@ -0,0 +1,25 @@ +From d78b3424dd9e72132df9b52ee4e5422cd3094bd6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pawe=C5=82=20Rozlach?= <vesp...@users.noreply.github.com> +Date: Mon, 18 Feb 2019 18:40:51 +0100 +Subject: [PATCH] flatpak_remote: Handle empty output in remote_exists (#52010) + +`flatpak remote-list -d` can return an empty output on Fedora 29 (version 1.2.0). + +(cherry picked from commit fcb6f136cde38dd562f89cf079abb2450b0d4622) +--- + lib/ansible/modules/packaging/os/flatpak_remote.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lib/ansible/modules/packaging/os/flatpak_remote.py b/lib/ansible/modules/packaging/os/flatpak_remote.py +index 508af3c927e08..64a632a98e432 100644 +--- a/lib/ansible/modules/packaging/os/flatpak_remote.py ++++ b/lib/ansible/modules/packaging/os/flatpak_remote.py +@@ -169,6 +169,8 @@ def remote_exists(module, binary, name, method): + output = _flatpak_command(module, False, command) + for line in output.splitlines(): + listed_remote = line.split() ++ if len(listed_remote) == 0: ++ continue + if listed_remote[0] == to_native(name): + return True + return False diff -Nru ansible-2.7.7+dfsg/debian/patches/series ansible-2.7.7+dfsg/debian/patches/series --- ansible-2.7.7+dfsg/debian/patches/series 2019-02-21 00:13:04.000000000 +0100 +++ ansible-2.7.7+dfsg/debian/patches/series 2020-02-07 22:07:29.000000000 +0100 @@ -2,3 +2,4 @@ 0004-correct-srtd-deletion.patch 0005-use-py3.patch 0006-fix-CVE-2019-3828.patch +d78b3424dd9e72132df9b52ee4e5422cd3094bd6.patch