Skip to content

Conversation

@jcastill
Copy link
Member

Some subscription_manager options have been deprecated in RHEL 10,
and when they are run thrown an error. This fix adds a check for OS version
and if it's not RHEL 10, runs the deprecated commands.

Related: RHEL-130523


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname [email protected]?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?
  • Are all passwords or private data gathered by this PR obfuscated?

@packit-as-a-service
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-4165
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@jcastill jcastill marked this pull request as draft November 24, 2025 11:04
@jcastill jcastill force-pushed the jcastillo-check-subscr-manager-version branch from 9cb8e04 to a36ea69 Compare December 3, 2025 10:53
], cmd_as_tag=True)
# Deprecated options in RHEL 10, that throw errors when run
smpkg = self.policy.package_manager.pkg_by_name('subscription-manager')
sm_version = '.'.join(smpkg['version'])
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure if I should add here a quick check for smpkg being None. The plugin can be activated without 'subscription-manager' being present, so it could happen that there's no package anymore in the system

# Deprecated options in RHEL 10, that throw errors when run
smpkg = self.policy.package_manager.pkg_by_name('subscription-manager')
sm_version = '.'.join(smpkg['version'])
if sos_parse_version(sm_version) < sos_parse_version('1.30.3-1'):
Copy link
Member Author

Choose a reason for hiding this comment

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

Another option could be to check here first if smpkg exists, before going into comparing the versions.
@pmoravec thoughts on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to the check. Since when I run the plugin on Fedora with no sub-man, I get even 2 backtraces:

Traceback (most recent call last):
  File "/root/sos-main/sos/report/__init__.py", line 1270, in setup
    plug.setup()
    ~~~~~~~~~~^^
  File "/root/sos-main/sos/report/plugins/subscription_manager.py", line 83, in setup
    sm_version = '.'.join(smpkg['version'])
                          ~~~~~^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

Traceback (most recent call last):
  File "/root/sos-main/sos/report/__init__.py", line 1508, in postproc
    plug.postproc()
    ~~~~~~~~~~~~~^^
  File "/root/sos-main/sos/report/plugins/subscription_manager.py", line 135, in postproc
    if self._curl_cfg_fname:
       ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'SubscriptionManager' object has no attribute '_curl_cfg_fname'

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me fix and push. My guess is that this should solve the issue with centos, but lets see

@packit-as-a-service
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo dnf install -y 'dnf*-command(copr)'
  • dnf copr enable packit/sosreport-sos-4165
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@jcastill
Copy link
Member Author

jcastill commented Dec 3, 2025

I'm investigating the centos-stream-9 error

@jcastill jcastill force-pushed the jcastillo-check-subscr-manager-version branch from a36ea69 to 9c3bd52 Compare December 4, 2025 09:29
Some subscription_manager options have been deprecated
in RHEL 10, and when they are run thrown an error.
This fix adds a check for OS version and if it's
not RHEL 10, runs the deprecated commands.

Related: RHEL-130523

Signed-off-by: Jose Castillo <[email protected]>
@jcastill jcastill force-pushed the jcastillo-check-subscr-manager-version branch from 9c3bd52 to d36563a Compare December 4, 2025 10:03
Copy link
Contributor

@pmoravec pmoravec left a comment

Choose a reason for hiding this comment

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

Sounds good! No uncaught exception on system without sub-man, commands collected on RHEL9 but not on RHEL10 (resp. on the relevant sub-man verison).

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.

2 participants