Skip to content

Commit

Permalink
feat: Eliminate command 'remove' from subscription-manager
Browse files Browse the repository at this point in the history
This PR eliminates the subscription-manager remove sub-command.

fixes: https://issues.redhat.com/browse/CCT-426
  • Loading branch information
jvlcek committed Aug 8, 2024
1 parent 3565182 commit 069cc19
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 416 deletions.
26 changes: 1 addition & 25 deletions etc-conf/subscription-manager.completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,6 @@ _subscription_manager_unregister()
COMPREPLY=($(compgen -W "${opts}" -- ${1}))
}

_subscription_manager_remove()
{
# try to autocomplete serial number as well
case $prev in
--serial)
SERIALS=$(LANG=C /usr/sbin/subscription-manager list --consumed 2>/dev/null | sed -ne "s|Serial:\s*\(\S*\)|\1|p" )
COMPREPLY=($(compgen -W "${SERIALS}" -- ${1}))
return 0
;;
--pool)
POOLS=$(LANG=C /usr/sbin/subscription-manager list --consumed 2>/dev/null | sed -ne "s|Pool ID:\s*(\S*\)|\1|p" )
COMPREPLY=($(compgen -W "${POOLS}" -- ${1}))
return 0
;;
esac
local opts="--serial --pool --all
${_subscription_manager_common_opts}"
COMPREPLY=($(compgen -W "${opts}" -- ${1}))
}

_subscription_manager_clean()
{
local opts="-h --help"
Expand Down Expand Up @@ -261,7 +241,7 @@ _subscription_manager()

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

case "${first}" in
Expand Down Expand Up @@ -289,10 +269,6 @@ _subscription_manager()
"_subscription_manager_attach" "${cur}" "${prev}"
return 0
;;
remove)
"_subscription_manager_remove" "${cur}" "${prev}"
return 0
;;
auto-attach)
"_subscription_manager_auto_attach" "${cur}" "${prev}"
return 0
Expand Down
72 changes: 19 additions & 53 deletions man/subscription-manager.8
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Subscription Manager performs several key operations:
.IP
* It lists both available and used subscriptions.
.IP
* It allows administrators to both attach specific subscriptions to a system and remove those subscriptions.
* It allows administrators to attach specific subscriptions to a system.
.PP
Subscription Manager can be used to auto-attach subscriptions to a system, as well. The
.B subscription-manager
Expand Down Expand Up @@ -83,59 +83,56 @@ must be passed as system arguments in a non-interactive session.
4. auto-attach

.IP
5. remove
5. release

.IP
6. release
6. redeem

.IP
8. redeem
7. list

.IP
9. list
8. refresh

.IP
10. refresh
9. environments

.IP
11. environments
10. repos

.IP
12. repos
11. orgs

.IP
13. orgs
12. plugins

.IP
14. plugins
13. identity

.IP
15. identity
14. facts

.IP
16. facts
15. clean

.IP
17. clean
16. config

.IP
18. config
17. version

.IP
19. version
18. status

.IP
20. status
19. syspurpose

.IP
21. syspurpose

.IP
22. repo-override
20. repo-override

.RE

Following commands were deprecated: subscribe and unsubscribe
Following commands were deprecated: subscribe.

.SS COMMON OPTIONS
.TP
Expand Down Expand Up @@ -351,33 +348,6 @@ Disables the auto-attach option for the system. If auto-attach is disabled, then
.B --show
Shows whether auto-attach is enabled on the systems.

.SS REMOVE OPTIONS
The
.B remove
command removes a subscription from the system. (This does not uninstall the associated products.)

.TP
.B --serial=SERIALNUMBER
Gives the serial number of the subscription certificate for the specific product to remove from the system. Subscription certificates attached to a system are in a certificate, in
.B /etc/pki/entitlement/<serial_number>.pem.
To remove multiple subscriptions, use the
.B --serial
option multiple times.

.TP
.B --pool=POOLID
Removes all subscription certificates for the specified pool id from the system.
To remove multiple sets of subscriptions, use the
.B --pool
option multiple times.

.TP
.B --all
Removes
.I all
of the subscriptions attached to a system.


.SS RELEASE OPTIONS
The
.B release
Expand Down Expand Up @@ -1013,16 +983,12 @@ Overall Status: Insufficient
.RE

.SS DEPRECATED COMMANDS
As the structures of subscription configuration have changed, some of the original management commands have become obsolete. These commands have been replaced with updated commands.
As the structures of subscription configuration have changed, some of the original management commands have become obsolete. Some of these commands have been replaced with updated commands.

.TP
.B subscribe
This has been replaced with attach. A similar registration option, \fB--subscribe\fP, has also be replaced with \fB--auto-attach\fP.

.TP
.B unsubscribe
This has been replaced with \fBremove\fP.

.SH USAGE
.B subscription-manager
has two major tasks:
Expand Down
212 changes: 0 additions & 212 deletions src/subscription_manager/cli_command/remove.py

This file was deleted.

Loading

0 comments on commit 069cc19

Please sign in to comment.