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

Yum + LSB fix making package installation on CentOS possible #400

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hallback
Copy link

When using Python 3, package installation with fetch in charmhelpers does not work since the Python module "yum" is only available for Python2. Simple tasks like checking if packages are installed can easily be performed by RPM instead.

Furthermore, package installations on CentOS were previously carried out with apt (which fails), this has been fixed.

LSB: The variable DISTRIB_CODENAME used for checking if we're using a systemd system is not available in /etc/os-release on CentOS, which throws a KeyError. This information is available in /etc/os-release from CentOS/RHEL 7 and above, which also use systemd.

In fetch module:

- prevents CentOS deployments from using Ubuntu specific functions in
  fetch/__init__.py
- removed dependency on yum.py from Python2 in fetch/centos.py

In host factory:

- cmp_pgrevno() can now be run with Python 3
- does not require root to run anymore
- replaced yum with rpm -q using subprocess (faster)
- no logic changed
init_is_systemd() was looking for the non-existing DISTRIB_CODENAME
in /etc/os-release via the lsb_release() function, which generates
a KeyError on CentOS.

The distribution info on CentOS is in /etc/os-release since version
7, which is also when systemd was introduced. If this file is not
present, we can safely assume CentOS 6 or older.
Copy link
Contributor

@ajkavanagh ajkavanagh left a comment

Choose a reason for hiding this comment

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

LGTM

@erik78se
Copy link

erik78se commented Jan 3, 2020

LGTM

@hallback
Copy link
Author

LGTM

Thanks @ajkavanagh, I think Rick Harding will bring this up with you later today, just a heads up.

@jamesbeedy
Copy link
Contributor

Hey guys, how is this coming along?

@mitechie
Copy link
Contributor

mitechie commented Mar 5, 2020

Hey guys, how is this coming along?

I think we were looking for the branch to get updated so it was up to date with latest trunk?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants