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

yum_versionlock not idempotent when version provided #4470

Closed
1 task done
tedgin opened this issue Apr 8, 2022 · 9 comments · Fixed by #6861
Closed
1 task done

yum_versionlock not idempotent when version provided #4470

tedgin opened this issue Apr 8, 2022 · 9 comments · Fixed by #6861
Labels
bug This issue/PR relates to a bug has_pr module module os packaging plugins plugin (any type)

Comments

@tedgin
Copy link

tedgin commented Apr 8, 2022

Summary

When I specify that yum_versionlock ensures that a package is locked to a specific version, and the package is already locked to that version. yum_versionlock reports a state change, even though yum versionlock list shows no change. This appears to be a regression, because if I revert back to community.general version 3.2, yum_versionlock doesn't report a state change.

Here's an example task.

---
name: lock iCommands to version 4.2.8
community.general.yum_versionlock:
  name: irods-icommands-4.2.8
  state: present

Issue Type

Bug Report

Component Name

yum_versionlock

Ansible Version

$ ansible --version
ansible [core 2.12.4]
  config file = /home/tedgin/.ansible.cfg
  configured module search path = ['/home/tedgin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/tedgin/.local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/tedgin/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/tedgin/.local/bin/ansible
  python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]
  jinja version = 3.0.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

# /home/tedgin/.local/lib/python3.8/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 4.7.0  

# /home/tedgin/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 4.7.0  

Configuration

$ ansible-config dump --only-changed
ANSIBLE_PIPELINING(/home/tedgin/.ansible.cfg) = True
DEFAULT_TIMEOUT(/home/tedgin/.ansible.cfg) = 20
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = /home/tedgin/.ansible_vault_pass.txt
INTERPRETER_PYTHON(/home/tedgin/.ansible.cfg) = /usr/bin/python3
RETRY_FILES_ENABLED(/home/tedgin/.ansible.cfg) = False

OS / Environment

Ansible control node is running either CentOS 7 or Ubuntu 20.04. The managed node is running CentOS 7.

Steps to Reproduce

---
- name: demo issue
  hosts: provider_configured.dstesting
  tasks:
    - name: lock iCommands to version 4.2.8
      community.general.yum_versionlock:
        name: irods-icommands-4.2.8
        state: present

Expected Results

I expect yum_versionlock to respond with ok.

Actual Results

$ # Here's what yum thinks is locked before running the task.
$ ssh provider_configured.dstesting yum versionlock list
Loaded plugins: fastestmirror, ovl, versionlock
0:irods-netcdf-icommands-4.2.8.0-1.*
versionlock list done
$ 
$ ansible-playbook demo.yml

PLAY [demo] ********************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************
ok: [provider_configured.dstesting]

TASK [lock iCommands to version 4.2.8] *****************************************************************************
changed: [provider_configured.dstesting]

PLAY RECAP *********************************************************************************************************
provider_configured.dstesting : ok=1   changed=1    unreachable=0    failed=0    skipped=9    rescued=0    ignored=0 

$ # To ensure nothing change, here's what `yum versionlock` thinks is locked after running the task.
$ ssh provider_configured.dstesting yum versionlock list
Loaded plugins: fastestmirror, ovl, versionlock
0:irods-netcdf-icommands-4.2.8.0-1.*
versionlock list done

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 Apr 8, 2022
tedgin pushed a commit to cyverse/ds-playbooks that referenced this issue Aug 29, 2022
See ansible-collections/community.general#4470
for details about the bug.  Previously, holding back the version of the
community.general collection to version 3.2 prevented the bug from
impacting us, but now this version can no longer be installed. Since the
bug only impacts idempotency, we decided to switch to the most recent
version of community.general and mark all yum_versionlock tasks as
non_idempotent.
@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

@matt-horwood-mayden
Copy link

any news on this?

@felixfontein
Copy link
Collaborator

There has been no functional change to this module since April 2022, so I guess this hasn't been fixed. There are no active maintainers for it, so if someone wants to contribute a fix, that's definitely welcome!

@gyptazy
Copy link
Contributor

gyptazy commented Jul 6, 2023

Hey,

just added PR #6861 which should care about version suffixes, now. Please give it a try and let me know if it works for you. Now, it should be able to handle the plain package name, as well as the package name including its version as a suffix properly.

Cheers,
gyptazy

@felixfontein
Copy link
Collaborator

While looking at the PR I noticed that the module never mentions that passing a version is actually allowed input. So from that point of view, this isn't a bug, but a feature request. That this worked in an earlier version of the module was a random coincidence, also in community.general 3.2.0 the documentation and examples didn't mention that providing a version is supported (see https://github.com/ansible-collections/community.general/blob/3.2.0/plugins/modules/packaging/os/yum_versionlock.py for the code from that version, which includes the documentation and the examples).

@gyptazy
Copy link
Contributor

gyptazy commented Jul 9, 2023

Fair enough, I've just adjusted the PR. This should fit and cover this, now.

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

Successfully merging a pull request may close this issue.

5 participants