community.general icon indicating copy to clipboard operation
community.general copied to clipboard

[flatpak] Can’t remove runtimes

Open fbruetting opened this issue 5 years ago • 7 comments
trafficstars

SUMMARY

I just can’t remove runtimes.

ISSUE TYPE
  • Bug Report
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)

fbruetting avatar Jun 21 '20 19:06 fbruetting

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 avatar Jun 21 '20 19:06 ansibullbot

cc @JayKayy @oolongbrothers click here for bot help

ansibullbot avatar Jun 21 '20 19:06 ansibullbot

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:

  • confirm the problem still exists, on Ansible 2.11.x? (2.9.9 is too old - in fact is not supported anymore).
  • paste the output of the problem running with -vvv ?
  • don't make Ansible go to khaza-dum, we all know what happens there ;-)

russoz avatar Jul 31 '21 05:07 russoz

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.

fbruetting avatar Aug 03 '21 13:08 fbruetting

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.

felixfontein avatar Aug 04 '21 06:08 felixfontein

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

ansibullbot avatar Nov 11 '22 02:11 ansibullbot

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"
    ]
}

dchristidis avatar Aug 18 '24 12:08 dchristidis