-
Notifications
You must be signed in to change notification settings - Fork 593
[subscription_manager] Add condition to run deprecated options #4165
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
base: main
Are you sure you want to change the base?
[subscription_manager] Add condition to run deprecated options #4165
Conversation
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
9cb8e04 to
a36ea69
Compare
| ], 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']) |
There was a problem hiding this comment.
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'): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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'
There was a problem hiding this comment.
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
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
|
I'm investigating the centos-stream-9 error |
a36ea69 to
9c3bd52
Compare
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]>
9c3bd52 to
d36563a
Compare
pmoravec
left a comment
There was a problem hiding this 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).
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