Skip to content

Implement YUM and DNF support on AIX#61361

Merged
Ch3LL merged 10 commits intosaltstack:masterfrom
dmurphy18:aix_dnf_yum_60912
Jan 6, 2022
Merged

Implement YUM and DNF support on AIX#61361
Ch3LL merged 10 commits intosaltstack:masterfrom
dmurphy18:aix_dnf_yum_60912

Conversation

@dmurphy18
Copy link
Contributor

What does this PR do?

Implement YUM and DNF support on AIX, older Python 2 yum, Python 3 yum and dnf

What issues does this PR fix or reference?

Fixes: #60912

Previous Behavior

Only support for rpm install using rpm

New Behavior

Supports use of older Python 2 yum and newer Python 3 yum and dnf on AIX

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@dmurphy18 dmurphy18 requested a review from a team as a code owner December 13, 2021 22:20
@dmurphy18 dmurphy18 requested review from Ch3LL and removed request for a team December 13, 2021 22:20
@damon-atkins
Copy link
Contributor

damon-atkins commented Dec 14, 2021

A better approach is to use the existing providers e.g. dnf/yum and have pkg state allow passing the provider e.g. On AIX you would say provider = yum . Solaris has more than two package providers, the open source and native. Also now and then Linux vendors change the package app they use. ??? Mac also have more than one pkg provider ???

abc_pkg_install:
  pkg.installed:
    - name: abc
    - provider: yum

The above state would then use the yum modules to get a list of packages installed, and then install 'abc' if required and then post install, get a list of packages again, just like on Linux. The existing Yum/RPM Module/Util code would be reused.

@dmurphy18
Copy link
Contributor Author

dmurphy18 commented Dec 14, 2021

@damon-atkins Understand where you are coming from, but AIX has a number of issues and might just be that special case since there are several yum versions to be be handled:

  • yum Python 2 implementation which may be existing on older versions of AIX
  • yum version which redirects to a freeware version of yum
  • yum Python 3 implementation (which is really dnf under the covers) which may or may not be installed
  • yum may not even be installed on AIX system

The newer AIX yum/dnf also are not quite that available from regular RedHat / Centos where the code is essentially 64-bit. On AIX the new yum/dnf code leverages 32-bit Python 3 and associated 32-bit libraries. Also on AIX the rpm's available from the AIX Toolbox are not quite the same as those from RedHat / Centos, the spec files are quite different and appear to have been forked and the changelog is inconsistent with those available from Fedora repo's, further complicating support.

Noting that different versions of yum may co-exist depending on how the dnf/yum was installed (not a recommended action but could happen). Hence the code needs to distinguish between the different versions since the newer version of yum has additional options which are desirable. Hence stating provider = yum didn't quite cover the range of possibilities. As for Solaris, Solaris 10 will be 'nearly dead' (Princess Bride humor) come 2023, leaving Solaris 11 and IPS as the main targets for Solaris moving forward.

Lastly, the implementation for AIX is similar for Linux, thereby maintaining consistency, for example:
Ubuntu 20.04, Centos 7 and AIX the command to install bash is the same

salt-call --local pkg.install bash

@Ch3LL Ch3LL added the Phosphorus v3005.0 Release code name and version label Dec 14, 2021
Copy link
Contributor

@Ch3LL Ch3LL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still support Debian 9 which has python 3.5 so we cannot add f strings yet.

@damon-atkins
Copy link
Contributor

Hi @dmurphy18 Solaris Open Source Package Manager https://www.opencsw.org/. And then their is also Homebrew for Mac.

Being able to provide, a "provider" to the salt state, so it can override the module to be used for pkg.install etc

I do not believe you will not be able to use the pkg state to install this software for example.

bash_pkg_install:
  pkg.installed:
    - name: bash # Will this run the AIX native package manager or Yum

Will execute the default package manager on AIX and not yum (assuming the native package manager on AIX has a pkg state). Which means like Solaris to use an alternative package manger you need to all the module directly from the a state (sls) file.

bash_pkg_install:
  module.run:
    - pkg.install:
      - name: bash.rpm  

@dmurphy18
Copy link
Contributor Author

dmurphy18 commented Dec 15, 2021

@damon-atkins So this is for AIX, and extending what is currently there, filesets and rpm to install a rpm.
And actually if any of the versions of yum are installed, or dnf, yes the new code will successfully install the rpm using yum or dnf if they are available, if not, it will use rpm to install and if dependencies are not already installed, then fail with rpm , as it is currently.

I have actually tested this without the use of rpm extensions and if yum|dnf available, will attempt to use them to install, if fails will try to install as a fileset. For the removal case, AIX packaging will actually tell you if installed and an rpm, if so, very straight forward to uninstall as a fileset or as dnf|yum|rpm.

Also wrote tests, based on actual outputs and usage, so believe most of the corner cases are addressed.
As stated in the code, there are some filesets which currently are not supported, see documentation for install.

Adding a provider to override the pkg support for yum would also need to address filesets too, since aixpkg.py supports both.

Also the YUM and DNF implementations on AIX are being provided by IBM from their AIX Toolbox, the code changes are merely leveraging the IBM provided YUM and DNF support on AIX, similar to how yum and dnf are provided by RedHat on their OS's.

see https://www.ibm.com/support/pages/aix-toolbox-linux-applications-downloads-alpha

@dmurphy18
Copy link
Contributor Author

@Ch3LL updated for your review comments, let me know if I missed a log.debug message where the English needs to be elaborated

@dmurphy18 dmurphy18 requested a review from Ch3LL December 15, 2021 17:45
@damon-atkins
Copy link
Contributor

Thanks @dmurphy18 for answering the questions.

Copy link
Contributor

@Ch3LL Ch3LL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one suggestion, but not required.

@dmurphy18
Copy link
Contributor Author

rerun all

@dmurphy18
Copy link
Contributor Author

re-run all

@Ch3LL Ch3LL merged commit fae5bc7 into saltstack:master Jan 6, 2022
@dmurphy18 dmurphy18 deleted the aix_dnf_yum_60912 branch May 3, 2023 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Phosphorus v3005.0 Release code name and version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Update packaging support on AIX to allow for yum and dnf

4 participants