Skip to content

Commit

Permalink
Remove commands moved to syspurpose
Browse files Browse the repository at this point in the history
The deprecated addons, role, service-level and usage commands are no longer recognized. They are now available solely as subcommands of the syspurpose command.
  • Loading branch information
Glutexo authored and ptoscano committed Jul 15, 2024
1 parent b34e048 commit 6c57e52
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 48 deletions.
13 changes: 3 additions & 10 deletions etc-conf/subscription-manager.completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,11 @@ _subscription_manager()
done

# top-level commands and options
opts="addons attach auto-attach clean config environments facts identity list orgs
repo-override plugins redeem refresh register release remove repos role service-level status
syspurpose unregister usage version ${_subscription_manager_help_opts}"
opts="attach auto-attach clean config environments facts identity list orgs
repo-override plugins redeem refresh register release remove repos status
syspurpose unregister version ${_subscription_manager_help_opts}"

case "${first}" in
addons|\
clean|\
config|\
environments|\
Expand All @@ -279,19 +278,13 @@ _subscription_manager()
register|\
release|\
repos|\
role|\
status|\
syspurpose|\
unregister|\
usage|\
version)
"_subscription_manager_$first" "${cur}" "${prev}"
return 0
;;
service-level)
"_subscription_manager_service_level" "${cur}" "${prev}"
return 0
;;
attach)
"_subscription_manager_attach" "${cur}" "${prev}"
return 0
Expand Down
18 changes: 1 addition & 17 deletions man/subscription-manager.8
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ must be passed as system arguments in a non-interactive session.

.RE

Following commands were deprecated: addons, role, service-level, subscribe, unsubscribe, and usage
Following commands were deprecated: subscribe and unsubscribe

.SS COMMON OPTIONS
.TP
Expand Down Expand Up @@ -1023,22 +1023,6 @@ This has been replaced with attach. A similar registration option, \fB--subscrib
.B unsubscribe
This has been replaced with \fBremove\fP.

.TP
.B addons
This has been replaced with \fBsyspurpose addons\fP.

.TP
.B role
This has been replaced with \fBsyspurpose role\fP.

.TP
.B service-level
This has been replaced with \fBsyspurpose service-level\fP.

.TP
.B usage
This has been replaced with \fBsyspurpose usage\fP.

.SH USAGE
.B subscription-manager
has two major tasks:
Expand Down
7 changes: 3 additions & 4 deletions src/subscription_manager/cli_command/syspurpose.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@

class SyspurposeCommand(CliCommand):
"""
Syspurpose command for generic actions. This command will be used for all
syspurpose actions in the future and it will replace addons, role,
service-level and usage commands. It will be possible to set service-type
using this command.
Syspurpose command for generic actions. This command is used for all
syspurpose actions. It will be possible to set service-type using this
command.
Note: when the system is not registered, then it doesn't make any sense to
synchronize syspurpose values with candlepin server, because consumer
Expand Down
8 changes: 0 additions & 8 deletions src/subscription_manager/managercli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

from subscription_manager import managerlib
from subscription_manager.cli import CLI
from subscription_manager.cli_command.addons import AddonsCommand
from subscription_manager.cli_command.attach import AttachCommand
from subscription_manager.cli_command.autoheal import AutohealCommand
from subscription_manager.cli_command.clean import CleanCommand
Expand All @@ -41,12 +40,9 @@
from subscription_manager.cli_command.release import ReleaseCommand
from subscription_manager.cli_command.remove import RemoveCommand
from subscription_manager.cli_command.repos import ReposCommand
from subscription_manager.cli_command.role import RoleCommand
from subscription_manager.cli_command.service_level import ServiceLevelCommand
from subscription_manager.cli_command.status import StatusCommand
from subscription_manager.cli_command.syspurpose import SyspurposeCommand
from subscription_manager.cli_command.unregister import UnRegisterCommand
from subscription_manager.cli_command.usage import UsageCommand
from subscription_manager.cli_command.version import VersionCommand
from subscription_manager.i18n import ugettext as _
from subscription_manager.repolib import YumPluginManager
Expand All @@ -59,7 +55,6 @@ def __init__(self):
commands: List[Type[CliCommand]] = [
RegisterCommand,
UnRegisterCommand,
AddonsCommand,
ConfigCommand,
ListCommand,
IdentityCommand,
Expand All @@ -71,15 +66,12 @@ def __init__(self):
ReleaseCommand,
StatusCommand,
EnvironmentsCommand,
ServiceLevelCommand,
VersionCommand,
RemoveCommand,
AttachCommand,
PluginsCommand,
AutohealCommand,
OverrideCommand,
RoleCommand,
UsageCommand,
FactsCommand,
SyspurposeCommand,
]
Expand Down
6 changes: 3 additions & 3 deletions test/cli_command/test_addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

from ..test_managercli import TestCliCommand
from subscription_manager import syspurposelib
from subscription_manager import managercli
from subscription_manager.cli_command.addons import AddonsCommand

from ..fixture import Capture

from unittest.mock import patch


class TestAddonsCommand(TestCliCommand):
command_class = managercli.AddonsCommand
command_class = AddonsCommand

def _set_syspurpose(self, syspurpose):
"""
Expand All @@ -29,7 +29,7 @@ def setUp(self):
sp_patch = syspurpose_patch.start()
self.addCleanup(sp_patch.stop)
super(TestAddonsCommand, self).setUp()
argv_patcher = patch.object(sys, "argv", ["subscription-manager", "addons"])
argv_patcher = patch.object(sys, "argv", ["subscription-manager", "syspurpose", "addons"])
argv_patcher.start()
self.addCleanup(argv_patcher.stop)
syspurposelib.USER_SYSPURPOSE = self.write_tempfile("{}").name
Expand Down
8 changes: 4 additions & 4 deletions test/cli_command/test_role.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os

from ..test_managercli import TestCliProxyCommand
from subscription_manager import managercli
from subscription_manager.cli_command.abstract_syspurpose import AbstractSyspurposeCommand
from subscription_manager.cli_command.role import RoleCommand
import subscription_manager.injection as inj

from ..stubs import StubUEP
Expand All @@ -12,7 +12,7 @@


class TestSyspurposeCommand(TestCliProxyCommand):
command_class = managercli.RoleCommand
command_class = RoleCommand

def setUp(self):
synced_store_patch = patch("subscription_manager.cli_command.abstract_syspurpose.SyncedStore")
Expand All @@ -32,7 +32,7 @@ def test_show_option(self):


class TestRoleCommand(TestCliProxyCommand):
command_class = managercli.RoleCommand
command_class = RoleCommand

def setUp(self):
synced_store_patch = patch("subscription_manager.cli_command.abstract_syspurpose.SyncedStore")
Expand Down Expand Up @@ -399,7 +399,7 @@ def setUp(self):
self.handle_exception_mock.side_effect = self.do_reraise
self.addCleanup(self.handle_exception_mock)
super(TestRoleOrgCheckingCommand, self).setUp()
self.cc = managercli.RoleCommand()
self.cc = RoleCommand()
self.cc.is_registered = Mock(return_value=False)

def test_no_org(self):
Expand Down
4 changes: 2 additions & 2 deletions test/cli_command/test_service_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from ..test_managercli import TestCliProxyCommand
from subscription_manager import syspurposelib
from subscription_manager import managercli
from subscription_manager.cli_command.service_level import ServiceLevelCommand

from ..stubs import StubConsumerIdentity, StubUEP
from ..fixture import set_up_mock_sp_store
Expand All @@ -12,7 +12,7 @@


class TestServiceLevelCommand(TestCliProxyCommand):
command_class = managercli.ServiceLevelCommand
command_class = ServiceLevelCommand

def setUp(self):
syspurpose_patch = patch("syspurpose.files.SyncedStore")
Expand Down

0 comments on commit 6c57e52

Please sign in to comment.