Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
AttributeError occured when run python 3 bootstrap.py on RHEL9.0 Aplha.
Satellite6.9.0 Satellite 6.8.4 Satellite6.7.5 all have this issue.
Version-Release number of selected component (if applicable):
RHEL Compose: RHEL-9.0.0-20210316.8
subscription-manager-1.29.7-1.el9.x86_64
package dnf-plugin-subscription-manager is not installed
subscription-manager-cockpit-1.29.7-1.el9.noarch
python3-subscription-manager-rhsm-1.29.7-1.el9.x86_64
subscription-manager-rhsm-certificates-1.29.7-1.el9.x86_64
Satellite6.7.5
tfm-rubygem-katello-3.14.0.32-1.el7sat.noarch
katello-3.14.0-6.el7sat.noarch
candlepin-2.9.30-1.el7sat.noarch
Satellite6.9.0
tfm-rubygem-katello-3.18.1.20-1.el7sat.noarch
katello-3.18.1-3.el7sat.noarch
candlepin-3.1.26-1.el7sat.noarch
Satellite6.8.4
tfm-rubygem-katello-3.16.0.20-1.el7sat.noarch
katello-3.16.0-1.el7sat.noarch
candlepin-3.1.24-1.el7sat.noarch
How reproducible:
100%
Steps to Reproduce:
1. Get bootstrap.py for Satellite
# curl -o /root/bootstrap.py http://hpe-magnycours-01.hpe2.lab.eng.bos.redhat.com/pub/bootstrap.py; chmod +x bootstrap.py
2. Run python3 bootstrap.py
python3 /root/bootstrap.py --login=admin --password=admin --server=hpe-magnycours-01.hpe2.lab.eng.bos.redhat.com --location='Default Location' --organization='Default Organization' --hostgroup=hg --activationkey=RH00069_key --add-domain --force
rhsm-integrate: INFO: <<<Return Code: 1
rhsm-integrate: INFO: <<<Output:
Foreman Bootstrap Script
This script is designed to register new systems or to migrate an existing system to a Foreman server with Katello
Traceback (most recent call last):
File "/root/bootstrap.py", line 1180, in <module>
RELEASE = platform.linux_distribution()[1]
AttributeError: module 'platform' has no attribute 'linux_distribution'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/bootstrap.py", line 1183, in <module>
RELEASE = platform.dist()[1]
AttributeError: module 'platform' has no attribute 'dist'
Actual results:
AttributeError occured when run python 3 bootstrap.py on RHEL9.0 Aplha.
Expected results:
It should be successful to register by bootstrap.py
For example:
# python3 /root/bootstrap.py --login=admin --password=admin --server=intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com --location='Default Location' --organization='Default Organization' --hostgroup=hg --activationkey=RH00069_key --add-domain --force
19:03:28 2021-03-15 06:45:06,193 [INFO]: <<<Return Code: 1
19:03:28 2021-03-15 06:45:06,194 [INFO]: <<<Output:
19:03:28 Foreman Bootstrap Script
19:03:28 This script is designed to register new systems or to migrate an existing system to a Foreman server with Katello
19:03:28 [NOTIFICATION], [2021-03-15 12:03:05], [This system is not registered to RHN. Attempting to register via subscription-manager]
19:03:28 [NOTIFICATION], [2021-03-15 12:03:05], [Checking subscription manager prerequisites]
19:03:28 [[94mRUNNING[0m], [2021-03-15 12:03:05], [/usr/bin/yum -y remove subscription-manager-gnome]
19:03:28 Updating Subscription Management repositories.
19:03:28 Unable to read consumer identity
19:03:28
19:03:28 This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
19:03:28
19:03:28 No match for argument: subscription-manager-gnome
19:03:28 No packages marked for removal.
19:03:28 Dependencies resolved.
19:03:28 Nothing to do.
19:03:28 Complete!
.......
19:03:28 [[94mRUNNING[0m], [2021-03-15 12:03:18], [/usr/sbin/subscription-manager register --org 'Default_Organization' --name 'kvm-02-guest03.hv2.lab.eng.bos.redhat.com' --activationkey 'RH00069_key' --serverurl=https://intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:443/rhsm --baseurl=https://intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com/pulp/repos --force]
19:03:28 The system has been registered with ID: 6c9c0ff6-67ba-4b09-8715-6619eaeed6b4
19:03:28 The registered system name is: kvm-02-guest03.hv2.lab.eng.bos.redhat.com
19:03:28 Installed Product Current Status:
19:03:28 Product Name: Red Hat Enterprise Linux for x86_64 Beta
19:03:28 Status: Subscribed
19:03:28
19:03:28 [[92mSUCCESS[0m], [2021-03-15 12:03:24], [/usr/sbin/subscription-manager register --org 'Default_Organization' --name 'kvm-02-guest03.hv2.lab.eng.bos.redhat.com' --activationkey 'RH00069_key' --serverurl=https://intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:443/rhsm --baseurl=https://intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com/pulp/repos --force], completed successfully.
Additional info:
Same issue (Red Hat Satellite 6.9.4 and RHEL9.0)
According to a comment found here (https://github.com/FabriceSalvaire/CodeReview/issues/48)
- "platform.dist" is deprecated since python version 2.6.
- "platform.linux_distribution" was the successor but is deprecated since Python 3.5 and removed in Python 3.8
This seem to be the successor: https://pypi.org/project/distro/
Kind Regards,
Claudio
Moreover i see in Foreman GitHub this code block:
try:
# pylint:disable=deprecated-method
RELEASE = platform.linux_distribution()[1]
except AttributeError:
try:
# pylint:disable=deprecated-method,no-member
RELEASE = platform.dist()[1]
except AttributeError:
RELEASE = release_from_etc()
In "release_from_etc()" function there' a note: "Used on systems with Python 3.8+ which doesn't provide that in the platform module anymore."
We need the backport for RedHat Satellite 6.9+ (possibly)
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHSA-2022:5498