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

fix alternatives parsing when they are part of a group #3976

Merged

Conversation

guillomovitch
Copy link
Contributor

SUMMARY

Fixes 'alternatives --display' output parsing when an alternative is part of a group.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

alternatives

ADDITIONAL INFORMATION

When an alternative is a part of a family (a group with master and slave links), an additional piece of information is present in 'alternatives --display' output , such as:

java - status is auto.
 link currently points to /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre/bin/java
/usr/lib/jvm/java-11-openjdk-11.0.13.0.8-3.el8_5.x86_64/bin/java - family java-11-openjdk.x86_64 priority 1
 slave alt-java: /usr/lib/jvm/java-11-openjdk-11.0.13.0.8-3.el8_5.x86_64/bin/alt-java
...
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre/bin/java - family java-1.8.0-openjdk.x86_64 priority 1800312
 slave alt-java: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre/bin/alt-java
...
Current `best' version is /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre/bin/java.

Without this fix, ansible never find an existing alternative, and always installs a new one before activating it, breaking the group at the same time.

@ansibullbot
Copy link
Collaborator

cc @mulby
click here for bot help

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module new_contributor Help guide this first time contributor plugins plugin (any type) small_patch Hopefully easy to review system labels Jan 4, 2022
@felixfontein felixfontein added backport-3 check-before-release PR will be looked at again shortly before release and merged if possible. labels Jan 4, 2022
@felixfontein
Copy link
Collaborator

Thanks for your contribution! Can you please add a changelog fragment?

@ansibullbot ansibullbot removed the small_patch Hopefully easy to review label Jan 5, 2022
@felixfontein
Copy link
Collaborator

I'm not really familiar with the alternatives tool, but this looks like it shouldn't break anything.

@boricj since you reported #3751, could you try out whether this fixes your issue?

@boricj
Copy link

boricj commented Jan 6, 2022

I no longer have the setup to test this against, but I believe this would fix that particular issue.

@felixfontein
Copy link
Collaborator

Thanks for the feedback. If nobody complains until next Monday, I'll merge this then.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jan 10, 2022
@felixfontein felixfontein merged commit a675afc into ansible-collections:main Jan 10, 2022
@patchback
Copy link

patchback bot commented Jan 10, 2022

Backport to stable-3: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-3/a675afcba9ab167832a6d273eb272e6a3d5ac216/pr-3976

Backported as #4020

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jan 10, 2022
* fix alternatives parsing when they are part of a group

* add changelog fragment

Co-authored-by: Guillaume Rousse <guillaume.rousse@renater.fr>
(cherry picked from commit a675afc)
@felixfontein
Copy link
Collaborator

@guillomovitch thanks for fixing this!
@boricj thanks for checking!

@patchback
Copy link

patchback bot commented Jan 10, 2022

Backport to stable-4: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-4/a675afcba9ab167832a6d273eb272e6a3d5ac216/pr-3976

Backported as #4021

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jan 10, 2022
* fix alternatives parsing when they are part of a group

* add changelog fragment

Co-authored-by: Guillaume Rousse <guillaume.rousse@renater.fr>
(cherry picked from commit a675afc)
felixfontein pushed a commit that referenced this pull request Jan 10, 2022
* fix alternatives parsing when they are part of a group

* add changelog fragment

Co-authored-by: Guillaume Rousse <guillaume.rousse@renater.fr>
(cherry picked from commit a675afc)

Co-authored-by: Guillaume Rousse <guillomovitch@gmail.com>
felixfontein pushed a commit that referenced this pull request Jan 10, 2022
* fix alternatives parsing when they are part of a group

* add changelog fragment

Co-authored-by: Guillaume Rousse <guillaume.rousse@renater.fr>
(cherry picked from commit a675afc)

Co-authored-by: Guillaume Rousse <guillomovitch@gmail.com>
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 module module new_contributor Help guide this first time contributor plugins plugin (any type) system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants