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

pkg_mgr.py looks in wrong directories for installp and dnf on AIX 7(.2) #83021

Open
1 task done
StevePOI opened this issue Apr 11, 2024 · 10 comments
Open
1 task done

pkg_mgr.py looks in wrong directories for installp and dnf on AIX 7(.2) #83021

StevePOI opened this issue Apr 11, 2024 · 10 comments
Labels
affects_2.14 bug This issue/PR relates to a bug.

Comments

@StevePOI
Copy link

StevePOI commented Apr 11, 2024

Summary

Hello!

I was looking why the ansible_pkg_mgr fact was returned as "unknown" on my AIX 7.2 servers, event though I have, additional to the required bos.rte.install *1 (for installp) the DNF environment from the "AIX Toolbox for Linux" *2 installed:

) find /usr -name "installp" -ls 2>/dev/null

  1130    740 -r-x------   1 root     system     755811 Aug 15  2023 **/usr/sbin/installp**

) find /opt/freeware/bin -name "dnf*" 2>/dev/null -ls

 5258      0 lrwxrwxrwx   1 root     system          5 Jun 20  2023 /opt/freeware/bin/dnf -> dnf-3
 5411      4 -rwxr-xr-x   1 root     system       1960 Apr 28  2023 **/opt/freeware/bin/dnf-3**
 5299      4 -rwxr-xr-x   1 root     system       1297 Apr 28  2023 /opt/freeware/bin/dnf-automatic

) lslpp -w /usr/sbin/installp

File Fileset Type
/usr/sbin/installp bos.rte.install File

*1: ) lslpp -L bos.rte.install

Fileset Level State Type Description (Uninstaller)
bos.rte.install 7.2.5.205 CE F LPP Install Commands

) rpm -qa|grep ^dnf
dnf-automatic-4.2.17-32_51.ppc
dnf-plugins-core-4.0.16-32_52.ppc
dnf-data-4.2.17-32_51.ppc
dnf-4.2.17-32_51.ppc
dnf-utils-4.0.16-32_52.ppc

*2: https://www.ibm.com/support/pages/node/6585774

Comparing this to https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/system/pkg_mgr.py :

Line 23:
{'path': '/usr/bin/dnf-3', 'name': 'dnf'},
Line 47:
{'path': '/usr/bin/installp', 'name': 'installp'},

A workaround would be to ln -s the paths, but maybe this could be adapted to the "correct" AIX paths?

Thanks!

Issue Type

Bug Report

Component Name

pkg_mgr.py

https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/system/pkg_mgr.py#L23
https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/system/pkg_mgr.py#L47

Ansible Version

$ ansible --version
ansible [core 2.14.13]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/freeware/lib/python3.9/site-packages/ansible
  ansible collection location = /usr/share/ansible/collections
  executable location = /opt/freeware/bin/ansible.orig
  python version = 3.9.19 (main, Apr  5 2024, 05:08:51) [GCC 10.3.0] (/opt/freeware/bin/python3.9)
  jinja version = 3.1.2
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
CONFIG_FILE() = /etc/ansible/ansible.cfg
INTERPRETER_PYTHON(/etc/ansible/ansible.cfg) = auto_legacy_silent

OS / Environment

IBM AIX 7.2 TL 5 SP 7 (7200-05-07-2346)

Steps to Reproduce

gather_facts: true

Expected Results

 "ansible_pkg_mgr": "installp"

# or

"ansible_pkg_mgr": "dnf"

Actual Results

"ansible_pkg_mgr": "unknown"

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot ansibot added bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. affects_2.14 labels Apr 11, 2024
@ansibot
Copy link
Contributor

ansibot commented Apr 11, 2024

Files identified in the description:

None

If these files are incorrect, please update the component name section of the description or use the component bot command.

@ansibot
Copy link
Contributor

ansibot commented Apr 11, 2024

@StevePOI ansible-core 2.14 is not supported and no longer receives bug fixes. Please test against one of the supported versions of ansible-core, preferably the most recent one, to see whether the bug has been fixed.

click here for bot help

@StevePOI
Copy link
Author

StevePOI commented Apr 11, 2024

@ansibot

"ansible-core" 2.14.13 is the newest version available on AIX, see https://www.ibm.com/support/pages/node/883796#A

"ansible" has version 7.2.0

@StevePOI
Copy link
Author

@ansibot component /opt/freeware/lib/python3.9/site-packages/ansible/module_utils/facts/system/pkg_mgr.py

@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Apr 11, 2024
@bcoca
Copy link
Member

bcoca commented Apr 11, 2024

this seems like a job for a custom facts module ...

@StevePOI
Copy link
Author

@StevePOI
Copy link
Author

this seems like a job for a custom facts module ...

Hello @bcoca !

What do you mean by that?

"installp" is AFAIK only used on IBM AIX and the path set by pkg_mgr.py is not correct.

Sorry if I don´t understand, this is my first issue here :) .

Thanks,

With kind regards,

Steve

@bcoca
Copy link
Member

bcoca commented Apr 11, 2024

First, it is not correct 'now' .. I assume it was correct at one point until AIX changed as AIX users had contributed that code and no one had complained in several years.

Since we don't have access to AIX to test we count on users keeping this up to date, but this is not really sustainable.

One way to address this is having custom/platform specific facts modules, use those via configuration in gather_facts action and not rely on the core 'setup' module, which we plan to sunset, for this and other reasons.

@StevePOI
Copy link
Author

Hello @bcoca !

First, it is not correct 'now' .. I assume it was correct at one point until AIX changed as AIX users had contributed that code and no one had complained in several years.

That could be true, the line with installp and the issue that created it is from 2019, AIX 7.2 is from 2015, never monitored the location of these essentials, just used them since they were in $PATH :)

Since we don't have access to AIX to test we count on users keeping this up to date, but this is not really sustainable.

I understand and would be glad to help with feedback regarding AIX :) .

One way to address this is having custom/platform specific facts modules, use those via configuration in gather_facts action and not rely on the core 'setup' module, which we plan to sunset, for this and other reasons.

Do I understand it correctly that this is something planned for Ansible as a whole or do you mean as a "each user has his/her own custom fact modules for their obscure OSes"?

Thanks for the information regarding "setup"!

With kind regards,

Steve

@bcoca
Copy link
Member

bcoca commented Apr 11, 2024

you CAN have per user facts modules now, it is configurable, but the intent is having 'per platform' and a more divisible facts load. right now you can workaround your issue with just having a facts module that returns the correct pkg_mgr key for ansible_facts, at least until we decide if this is something we need to correct in core (breaking backwards compat?) or if we just push to a facts gathering reorg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.14 bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants