From 474ff01aba62734afe8595e714719d7313e635b6 Mon Sep 17 00:00:00 2001 From: Jiri Hnidek Date: Fri, 31 May 2024 17:48:28 +0200 Subject: [PATCH] feat: 1.29 Deprecate redeem sub-command * Card ID: CCT-400 * Modified short description of command * Added warning that this command doesn't do anything, when SCA mode is used. When SCA mode is used, then display message returned form candlepin is also ignored. * Modified description in manual page of subscription-manager --- man/subscription-manager.8 | 4 ++-- src/subscription_manager/cli_command/redeem.py | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/man/subscription-manager.8 b/man/subscription-manager.8 index 8f3b41dc11..9e0b6733e2 100644 --- a/man/subscription-manager.8 +++ b/man/subscription-manager.8 @@ -610,7 +610,7 @@ Points to a certificate PEM file which contains the subscription certificate. Th .SS REDEEM OPTIONS The .B redeem -command is used for systems that are purchased from third-party vendors that include a subscription. The redemption process essentially auto-attaches the preselected subscription that the vendor supplied to the system. +command is deprecated, this command will be removed from the future major releases. This command is no-op, when simple content access mode is used. Command is used for systems that are purchased from third-party vendors that include a subscription. The redemption process essentially try to auto-attach the preselected subscription that the vendor supplied to the system. .TP .B --email=EMAIL @@ -1352,7 +1352,7 @@ its existing subscriptions. .PP After registration, subscriptions on preconfigured systems can be claimed using the .B redeem -command, which essentially auto-attaches the system to its preexisting subscriptions. +command, which essentially try to auto-attach the system to its preexisting subscriptions. .RS .nf diff --git a/src/subscription_manager/cli_command/redeem.py b/src/subscription_manager/cli_command/redeem.py index fe74273d68..ff6d9816ce 100644 --- a/src/subscription_manager/cli_command/redeem.py +++ b/src/subscription_manager/cli_command/redeem.py @@ -22,11 +22,16 @@ from subscription_manager.cli import system_exit from subscription_manager.cli_command.cli import CliCommand, handle_exception from subscription_manager.i18n import ugettext as _ +from subscription_manager.utils import is_simple_content_access class RedeemCommand(CliCommand): def __init__(self): - shortdesc = _("Attempt to redeem a subscription for a preconfigured system") + shortdesc = _( + "Deprecated, this command will be removed from the future major releases." + " This command is no-op in simple content access mode." + " Attempt to redeem a subscription for a preconfigured system" + ) super(RedeemCommand, self).__init__("redeem", shortdesc, False) self.parser.add_argument( @@ -59,6 +64,9 @@ def _do_command(self): self.assert_should_be_registered() self._validate_options() + if is_simple_content_access(self.cp): + print(_("Warning: This command is no-op in simple content access mode.")) + try: # FIXME: why just facts and package profile update here? # update facts first, if we need to @@ -73,7 +81,8 @@ def _do_command(self): if response is None: system_exit(os.EX_SOFTWARE, _("Error: Unable to redeem subscription for this system.")) if response.get("displayMessage"): - system_exit(0, response.get("displayMessage")) + if not is_simple_content_access(self.cp): + system_exit(0, response.get("displayMessage")) except connection.GoneException as ge: raise ge except connection.RestlibException as e: