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

5.1.0 breaks alternatives on RHEL 8 #4803

Closed
1 task done
jbpratt opened this issue Jun 8, 2022 · 6 comments · Fixed by #4836
Closed
1 task done

5.1.0 breaks alternatives on RHEL 8 #4803

jbpratt opened this issue Jun 8, 2022 · 6 comments · Fixed by #4836
Labels
bug This issue/PR relates to a bug has_pr module module plugins plugin (any type) system

Comments

@jbpratt
Copy link

jbpratt commented Jun 8, 2022

Summary

When I try to run the below task, I receive a usage error from update-alternatives. Prior to 5.1.0, this works as expected. It looks like the --slave argument is missing a required value (--slave unversioned-python /usr/bin/python3 compared to --slave <slave_link> <slave_name> <slave_path>). Downgrading to 5.0.2 is a workaround.

Issue Type

Bug Report

Component Name

alternatives

Ansible Version

$ ansible --version
ansible [core 2.12.6]
  config file = /tmp/y/ansible.cfg
  configured module search path = ['/var/home/bpratt/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /tmp/y/venv/lib64/python3.10/site-packages/ansible
  ansible collection location = /var/home/bpratt/.ansible/collections:/usr/share/ansible/collections
  executable location = /tmp/y/venv/bin/ansible-playbook
  python version = 3.10.4 (main, Mar 25 2022, 00:00:00) [GCC 12.0.1 20220308 (Red Hat 12.0.1-0)]
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

# /var/home/bpratt/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 5.1.0

# /tmp/y/venv/lib/python3.10/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 4.8.2

# /tmp/y/venv/lib64/python3.10/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 4.8.2

Configuration

$ ansible-config dump --only-changed

OS / Environment

RHEL 8

Steps to Reproduce

    - community.general.alternatives:
        name: python
        path: /usr/bin/python3
        link: /usr/bin/python

Expected Results

{"changed": true}

Actual Results

TASK [community.general.alternatives] *******************************************************************************************************************************************
task path: /tmp/xyz/playbook.yml:4
redirecting (type: modules) community.general.alternatives to community.general.system.alternatives
fatal: [10.0.101.1]: FAILED! => changed=false
  ansible_facts:
    discovered_interpreter_python: /usr/libexec/platform-python
  cmd: /usr/sbin/update-alternatives --install /usr/bin/python python /usr/bin/python3 50 --slave unversioned-python /usr/bin/python3 --slave unversioned-python-man /usr/share/man/man1/python3.1.gz
  msg: ''
  rc: 2
  stderr: ''
  stderr_lines: <omitted>
  stdout: |-
    alternatives version 1.19.1 - Copyright (C) 2001 Red Hat, Inc.
    This may be freely redistributed under the terms of the GNU Public License.

    usage: alternatives --install <link> <name> <path> <priority>
                        [--initscript <service>]
                        [--family <family>]
                        [--slave <slave_link> <slave_name> <slave_path>]*
           alternatives --remove <name> <path>
           alternatives --auto <name>
           alternatives --config <name>
           alternatives --display <name>
           alternatives --set <name> <path>
           alternatives --list
           alternatives --remove-all <name>
           alternatives --add-slave <name> <path> <slave_link> <slave_name> <slave_path>
           alternatives --remove-slave <name> <path> <slave_name>

    common options: --verbose --test --help --usage --version --keep-missing --keep-foreign
                    --altdir <directory> --admindir <directory>
  stdout_lines: <omitted>

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

cc @mulby
click here for bot help

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) system labels Jun 8, 2022
@felixfontein
Copy link
Collaborator

CC @jiuka

jiuka added a commit to jiuka/community.general that referenced this issue Jun 8, 2022
If neigther the priority nor the subcommands where specified the module decided to update the priority with the default value anyway. This resulted in bug ansible-collections#4803 and ansible-collections#4804
@felixfontein
Copy link
Collaborator

resolved_by_pr #4810

@felixfontein
Copy link
Collaborator

Unfortunately that PR does not fix this issue, see #4810 (comment)

felixfontein added a commit that referenced this issue Jun 13, 2022
* alternatives: Fix bug with priority default

If neigther the priority nor the subcommands where specified the module decided to update the priority with the default value anyway. This resulted in bug #4803 and #4804

* Add changelog fragment.

* Distinguish None from 0.

* Address review comments.

* Update plugins/modules/system/alternatives.py

Co-authored-by: Pilou <pierre-louis@libregerbil.fr>

* Remove unrelated issues from changelog.

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Pilou <pierre-louis@libregerbil.fr>
patchback bot pushed a commit that referenced this issue Jun 13, 2022
* alternatives: Fix bug with priority default

If neigther the priority nor the subcommands where specified the module decided to update the priority with the default value anyway. This resulted in bug #4803 and #4804

* Add changelog fragment.

* Distinguish None from 0.

* Address review comments.

* Update plugins/modules/system/alternatives.py

Co-authored-by: Pilou <pierre-louis@libregerbil.fr>

* Remove unrelated issues from changelog.

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Pilou <pierre-louis@libregerbil.fr>
(cherry picked from commit 57e83ac)
felixfontein pushed a commit that referenced this issue Jun 13, 2022
* alternatives: Fix bug with priority default

If neigther the priority nor the subcommands where specified the module decided to update the priority with the default value anyway. This resulted in bug #4803 and #4804

* Add changelog fragment.

* Distinguish None from 0.

* Address review comments.

* Update plugins/modules/system/alternatives.py

Co-authored-by: Pilou <pierre-louis@libregerbil.fr>

* Remove unrelated issues from changelog.

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Pilou <pierre-louis@libregerbil.fr>
(cherry picked from commit 57e83ac)

Co-authored-by: Marius Rieder <marius.rieder@durchmesser.ch>
@felixfontein
Copy link
Collaborator

resolved_by_pr #4836

This was referenced Nov 20, 2022
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 plugins plugin (any type) system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants