Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pacman latest fails if there is a dependency #4079

Open
1 task done
jamincollins opened this issue Jan 24, 2022 · 6 comments
Open
1 task done

pacman latest fails if there is a dependency #4079

jamincollins opened this issue Jan 24, 2022 · 6 comments
Labels
bug This issue/PR relates to a bug has_pr module module os packaging plugins plugin (any type)

Comments

@jamincollins
Copy link

Summary

If you execute the pacman packager with latest but reference a package with a dependency you can wind up with something like the following output:

{"changed": false, "msg": "package(s) already installed. But could not ensure 'latest' state for ['libvirt', 'libvirt-storage-rbd'] package(s) as remote version could not be fetched."}

Issue Type

Bug Report

Component Name

pacman

Ansible Version

$ ansible --version
ansible [core 2.12.1]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/jamin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /home/jamin/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.1 (main, Dec 18 2021, 23:53:45) [GCC 11.1.0]
  jinja version = 3.0.3
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

# /usr/lib/python3.10/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 4.3.0  

Configuration

$ ansible-config dump --only-changed

OS / Environment

Arch Linux

Steps to Reproduce

Have an older version of libvirt and libvirt-storage-rbd installed on the host:

---
- hosts: ceph
  tasks:
  - name: Update list of known packages
    community.general.pacman:
      update_cache: yes

  - name: Remove conflicting packages
    #ansible.builtin.package:
    community.general.pacman:
      name:
        - qemu
      state: absent

  - name: Ensure ceph related packages are installed
    #ansible.builtin.package:
    community.general.pacman:
      name:
        - ceph
        - qemu-headless
        - qemu-block-rbd
        - libvirt
        - libvirt-storage-rbd
      state: latest

Expected Results

That a libvirt and libvirt-storage-rbd upgrade be performed/detected if there is a newer version.

Actual Results

ok: [skald-2] => {"changed": false, "msg": "package(s) already installed. But could not ensure 'latest' state for ['libvirt', 'libvirt-storage-rbd'] package(s) as remote version could not be fetched."}

This appears to be caused by the package by package check done here:
https://github.com/ansible-collections/community.general/blob/main/plugins/modules/packaging/os/pacman.py#L354-L356

Queried individually, packages with dependencies can result in error:

$ pacman --sync --print-format "%n %v" libvirt; echo $?
error: failed to prepare transaction (could not satisfy dependencies)
:: installing libvirt (1:8.0.0-1) breaks dependency 'libvirt=7.10.0' required by libvirt-storage-rbd
1
$ pacman --sync --print-format "%n %v" libvirt-storage-rbd; echo $?
error: failed to prepare transaction (could not satisfy dependencies)
:: unable to satisfy dependency 'libvirt=8.0.0' required by libvirt-storage-rbd
1

However, queried together, they are not a problem:

$ pacman --sync --print-format "%n %v" libvirt libvirt-storage-rbd; echo $?
libvirt 1:8.0.0-1
libvirt-storage-rbd 1:8.0.0-1
0

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

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
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module os packaging plugins plugin (any type) labels Jan 24, 2022
@jamincollins jamincollins changed the title pacman latest fails if there a dependency pacman latest fails if there is a dependency Jan 24, 2022
@jamincollins
Copy link
Author

What's even worse on this is that without verbose output it claims it worked without issue:

TASK [Ensure ceph related packages are installed] *********************************************************************
ok: [langhus-1]
ok: [langhus-2]
ok: [langhus-3]
ok: [skald-2]
ok: [langhus-4]
ok: [skald-1]
ok: [langhus-5]

@felixfontein
Copy link
Collaborator

This might be fixed by #3907, you'd have to check. (That PR is very extensive and nobody had time to review it yet though...)

@ansibullbot
Copy link
Collaborator

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
Copy link
Collaborator

cc @jraby
click here for bot help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_pr module module os packaging plugins plugin (any type)
Projects
None yet
Development

No branches or pull requests

3 participants