ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
836 stars 1.53k forks source link

[flatpak] Can’t remove runtimes #553

Open fbruetting opened 4 years ago

fbruetting commented 4 years ago
SUMMARY

I just can’t remove runtimes.

ISSUE TYPE
COMPONENT NAME

flatpak

ANSIBLE VERSION
ansible 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/frank/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.8/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.3 (default, May 15 2020, 00:00:00) [GCC 10.1.1 20200507 (Red Hat 10.1.1-1)]
CONFIGURATION
OS / ENVIRONMENT

Fedora 32

STEPS TO REPRODUCE

On a new Fedora 32, you have org.fedoraproject.Platform and org.gnome.Extensions installed. When you want to delete them both, the following task would work just for the application, not for the runtime (I also tried with org.fedoraproject.Platform/x86_64/f32). The same way you can install org.gnome.Platform of the flathub repo and also there you would not be able to uninstall it.

- name: Test
  hosts: localhost
  gather_facts: yes
  become: yes

    - name:                 "Delete packages"
      when:                 (ansible_facts['distribution'] == "Fedora")
      flatpak:
        name:               "{{ item }}"
        state:              absent
        remote:             fedora
      loop:
                            - org.gnome.Extensions
                            - org.fedoraproject.Platform
EXPECTED RESULTS

I would expect that it works for runtimes, too.

ACTUAL RESULTS

Doesn’t work for runtimes:

TASK [Delete packages] ******************************************
changed: [khazad-dum] => (item=org.gnome.Extensions)
ok: [khazad-dum] => (item=org.fedoraproject.Platform)
ansibullbot commented 4 years ago

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 4 years ago

cc @JayKayy @oolongbrothers click here for bot help

russoz commented 3 years ago

Hi @fbruetting I was taking a look at this issue, and it does not seem like it would be too complicated to work on. Could you please:

fbruetting commented 3 years ago

I just have Ansible 2.9.23 in my non-Khazad-dûm machine (Khazad-dûm is even worse) - is this sufficient?

I can see if there is a COPR shipping more current Ansible for my Fedora.

felixfontein commented 3 years ago

Please note that Ansible 2.9 only receives critical security fixes, and no longer bugfixes. So you'll have to use the community.general collection instead of the modules included in Ansible 2.9 if you want this fixed.

ansibullbot commented 2 years ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

dchristidis commented 3 months ago

The underlying issue is similar to #6265. The use of the --app command-line option effectively means that the module is unable to handle runtimes. Removing this option allows the uninstallation to work if and only if no applications are using this runtime.

$ flatpak list --system
Name                         Application ID                        Version         Branch
Fedora Media Writer          org.fedoraproject.MediaWriter         5.1.2           stable
Fedora Platform              org.fedoraproject.Platform            40              f40
$ ansible -m community.general.flatpak -a '{"name": "org.fedoraproject.Platform", "state": "absent"}' localhost
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | FAILED! => {
    "changed": false,
    "cmd": "/usr/bin/flatpak uninstall --noninteractive --system org.fedoraproject.Platform",
    "msg": "Error: Failed to uninstall org.fedoraproject.Platform: Can't remove org.fedoraproject.Platform/x86_64/f40, it is needed for: org.fedoraproject.MediaWriter",
    "rc": 1,
    "stderr": "Error: Failed to uninstall org.fedoraproject.Platform: Can't remove org.fedoraproject.Platform/x86_64/f40, it is needed for: org.fedoraproject.MediaWriter\n",
    "stderr_lines": [
        "Error: Failed to uninstall org.fedoraproject.Platform: Can't remove org.fedoraproject.Platform/x86_64/f40, it is needed for: org.fedoraproject.MediaWriter"
    ],
    "stdout": "Info: applications using the runtime org.fedoraproject.Platform branch f40:\n   org.fedoraproject.MediaWriter\nUninstalling runtime/org.fedoraproject.Platform/x86_64/f40\n",
    "stdout_lines": [
        "Info: applications using the runtime org.fedoraproject.Platform branch f40:",
        "   org.fedoraproject.MediaWriter",
        "Uninstalling runtime/org.fedoraproject.Platform/x86_64/f40"
    ]
}
$ ansible -m community.general.flatpak -a '{"name": ["org.fedoraproject.MediaWriter", "org.fedoraproject.Platform"], "state": "absent"}' localhost
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | CHANGED => {
    "changed": true,
    "command": "/usr/bin/flatpak uninstall --noninteractive --system org.fedoraproject.MediaWriter org.fedoraproject.Platform",
    "rc": 0,
    "stderr": "",
    "stderr_lines": [],
    "stdout": "Uninstalling app/org.fedoraproject.MediaWriter/x86_64/stable\nUninstalling runtime/org.fedoraproject.Platform/x86_64/f40\n",
    "stdout_lines": [
        "Uninstalling app/org.fedoraproject.MediaWriter/x86_64/stable",
        "Uninstalling runtime/org.fedoraproject.Platform/x86_64/f40"
    ]
}