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
pkg_mgr: prohibit pkg5 usage on Altlinux #76457
Conversation
Filter out the /usr/bin/pkg because on Altlinux it is actually the perl-Package (not Solaris package manager). Since the pkg5 takes precedence over apt, this workaround is required to select the suitable package manager on Altlinux.
This would need a changelog, see https://docs.ansible.com/ansible/devel/community/development_process.html#changelogs-how-to. |
def pkg_mgrs(self, collected_facts): | ||
# Filter out the /usr/bin/pkg because on Altlinux it is actually the | ||
# perl-Package (not Solaris package manager). | ||
# Since the pkg5 takes precedence over apt, this workaround |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is incorrect, apt-get has higher precedence than pkg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's correct:
ansible/lib/ansible/module_utils/facts/system/pkg_mgr.py
Lines 13 to 15 in 7830e53
# A list of dicts. If there is a platform with more than one | |
# package manager, put the preferred one last. If there is an | |
# ansible module, use that as the value for the 'name' key. |
Each next pkg['name']
in PKG_MGRS
can rewrite the pkg_mgr_name
:
ansible/lib/ansible/module_utils/facts/system/pkg_mgr.py
Lines 121 to 123 in 7830e53
for pkg in PKG_MGRS: | |
if os.path.exists(pkg['path']): | |
pkg_mgr_name = pkg['name'] |
And so pkg5 takes precedence over apt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, I didn't look at all the code and assumed assumed there was a break on match, its last, not first, found wins ... which makes me want to rewrite this section.
Not only can we have multiple package managers (add fact with list), but the traversal can be reversed + break to make it perform better. Another 'optimization' would be to create diff lists for OS families.
merged this to fix this specific problem, but making note on needing to rethink pkg manager detection. |
Filter out the /usr/bin/pkg because on Altlinux it is actually the perl-Package (not Solaris package manager). Since the pkg5 takes precedence over apt, this workaround is required to select the suitable package manager on Altlinux.
SUMMARY
The current implementation expects
/usr/bin/pkg
aspkg5
package manager, but this is not suitable for Altlinux. There is anperl-Package
rpm package that has an executable with the same path aspkg5
(/usr/bin/pkg
).Since the
pkg5
takes precedence overapt
, this patch is required to select an appropriate package manager on Altlinux.ISSUE TYPE
COMPONENT NAME
pkg_mgr