1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

redhat_subscription: call 'remove' instead of 'unsubscribe' (#4809)

The 'unsubscribe' command of 'subscription-manager' was deprecated
already in subscription-manager 1.11.3, shipped with RHEL 5.11.
As it was removed in subscription-manager 1.29.x, unsubscribing from
pools was thus broken.

The simple fix is to call the proper command, 'remove'.
This commit is contained in:
Pino Toscano 2022-06-14 07:26:38 +02:00 committed by GitHub
parent 57e83ac80b
commit a45b90e93f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- redhat_subscription - fix unsubscribing on RHEL 9 (https://github.com/ansible-collections/community.general/issues/4741).

View file

@ -468,7 +468,7 @@ class Rhsm(RegistrationBase):
items = ["--all"] items = ["--all"]
if items: if items:
args = [SUBMAN_CMD, 'unsubscribe'] + items args = [SUBMAN_CMD, 'remove'] + items
rc, stderr, stdout = self.module.run_command(args, check_rc=True) rc, stderr, stdout = self.module.run_command(args, check_rc=True)
return serials return serials

View file

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# Author: Jiri Hnidek (jhnidek@redhat.com) # Author: Jiri Hnidek (jhnidek@redhat.com)
# #
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
@ -118,7 +119,7 @@ TEST_CASES = [
(0, 'system identity: b26df632-25ed-4452-8f89-0308bfd167cb', '') (0, 'system identity: b26df632-25ed-4452-8f89-0308bfd167cb', '')
), ),
( (
['/testbin/subscription-manager', 'unsubscribe', '--all'], ['/testbin/subscription-manager', 'remove', '--all'],
{'check_rc': True}, {'check_rc': True},
(0, '', '') (0, '', '')
), ),
@ -755,7 +756,7 @@ Entitlement Type: Physical
( (
[ [
'/testbin/subscription-manager', '/testbin/subscription-manager',
'unsubscribe', 'remove',
'--serial=7807912223970164816', '--serial=7807912223970164816',
], ],
{'check_rc': True}, {'check_rc': True},