Skip to content
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

feat: Remove deprecated syspurpose top-level commands #3417

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading