diff --git a/changelogs/fragments/9578-redhat_subscription-no-remove-on-unregister.yml b/changelogs/fragments/9578-redhat_subscription-no-remove-on-unregister.yml new file mode 100644 index 00000000000..1403b2faa12 --- /dev/null +++ b/changelogs/fragments/9578-redhat_subscription-no-remove-on-unregister.yml @@ -0,0 +1,7 @@ +bugfixes: + - | + redhat_subscription - do not try to unsubscribe (i.e. remove subscriptions) + when unregistering a system: newer versions of subscription-manager, as + available in EL 10 and Fedora 41+, do not support entitlements anymore, and + thus unsubscribing will fail + (https://github.com/ansible-collections/community.general/pull/9578). diff --git a/plugins/modules/redhat_subscription.py b/plugins/modules/redhat_subscription.py index 0ed06bc92ef..0b740645dbf 100644 --- a/plugins/modules/redhat_subscription.py +++ b/plugins/modules/redhat_subscription.py @@ -1119,7 +1119,6 @@ def main(): module.exit_json(changed=False, msg="System already unregistered.") else: try: - rhsm.unsubscribe() rhsm.unregister() except Exception as e: module.fail_json(msg="Failed to unregister: %s" % to_native(e)) diff --git a/tests/unit/plugins/modules/test_redhat_subscription.py b/tests/unit/plugins/modules/test_redhat_subscription.py index 7be3740d260..bbdbbdab7d8 100644 --- a/tests/unit/plugins/modules/test_redhat_subscription.py +++ b/tests/unit/plugins/modules/test_redhat_subscription.py @@ -199,11 +199,6 @@ def test_without_required_parameters_registered(mocker, capfd, patch_redhat_subs {'check_rc': False}, (0, 'system identity: b26df632-25ed-4452-8f89-0308bfd167cb', '') ), - ( - ['/testbin/subscription-manager', 'remove', '--all'], - {'check_rc': True}, - (0, '', '') - ), ( ['/testbin/subscription-manager', 'unregister'], {'check_rc': True},