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: Removed attach command #3409

Merged
merged 5 commits into from
Aug 28, 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
25 changes: 2 additions & 23 deletions etc-conf/subscription-manager.completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,6 @@ _subscription_manager_auto_attach()
COMPREPLY=($(compgen -W "${opts}" -- ${1}))
}

_subscription_manager_attach()
{
# try to autocomplete pool id's as well
# doesn't work well with sudo/non root users though
case $prev in
--pool)
# wee bit of a hack to handle that we can't actually run subscription-manager list --available unless
# we are root. try it directly (as opposed to userhelper links) and if it fails,ignore it
POOLS=$(LANG=C /usr/sbin/subscription-manager list --available 2>/dev/null | sed -ne "s|Pool ID:\s*\(\S*\)|\1|p" )
COMPREPLY=($(compgen -W "${POOLS}" -- ${1}))
return 0
esac
local opts="--auto --pool --quantity --servicelevel --file
${_subscription_manager_common_opts}"
COMPREPLY=($(compgen -W "${opts}" -- ${1}))
}

_subscription_manager_syspurpose()
{
local opts="role service-level usage --show ${_subscription_manager_common_opts}"
Expand Down Expand Up @@ -178,7 +161,7 @@ _subscription_manager_refresh()

_subscription_manager_register()
{
local opts="--activationkey --auto-attach --autosubscribe --baseurl --consumerid
local opts="--activationkey --baseurl --consumerid
--environments --force --name --org --password --release
--servicelevel --username --token
${_subscription_manager_common_url_opts}
Expand Down Expand Up @@ -243,7 +226,7 @@ _subscription_manager()
done

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

Expand All @@ -267,10 +250,6 @@ _subscription_manager()
"_subscription_manager_$first" "${cur}" "${prev}"
return 0
;;
attach)
"_subscription_manager_attach" "${cur}" "${prev}"
return 0
;;
remove)
"_subscription_manager_remove" "${cur}" "${prev}"
return 0
Expand Down
136 changes: 2 additions & 134 deletions man/subscription-manager.8
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ must be passed as system arguments in a non-interactive session.
.IP
2. unregister

.IP
3. attach

.IP
4. auto-attach
m-horky marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -132,7 +129,7 @@ must be passed as system arguments in a non-interactive session.

.RE

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

.SS COMMON OPTIONS
.TP
Expand Down Expand Up @@ -251,15 +248,6 @@ subscription-manager register --org="IT Dept" --activationkey=1234abcd
.fi
.RE

.TP
.B --auto-attach
Automatically attaches compatible subscriptions to this system.


.TP
.B --servicelevel=LEVEL
Sets the preferred service level to use with subscriptions added to the system. Service levels are commonly premium, standard, and none, though other levels may be available depending on the product and the contract.

.TP
.B --force
When the system is already registered, a new attempt to register will fail with a message reminding the user that the system is already registered. However, passing the
Expand Down Expand Up @@ -294,43 +282,6 @@ command does two important things. Firstly, it will implicitly remove all of the
.PP
This command has no options.

.SS ATTACH OPTIONS
The
.B attach
command applies a specific subscription to the system. This command is not possible to use, when the content access mode of the organization to which the system is registered is simple content access mode.

.TP
.B --auto
Automatically attaches the best-matched compatible subscription or subscriptions to the system. This is the default unless
.B --pool
or
.B --file
are used.

.TP
.B --pool=POOLID
Gives the ID for the subscriptions pool (collection of products) to attach to the system. This overrides the default of --auto.

.TP
.B --file=FILE
Specifies a file from which to read whitespace-delimited pool IDs. If FILE is "-", the pool IDs will be read from stdin. This overrides the default of
.B
--auto.

.TP
.B --quantity=NUMBER
Attaches a specified number of subscriptions to the system. Subscriptions may have certain limits on them, like the number of sockets on the system or the number of allowed virtual guests. It is possible to attach multiple subscriptions (or
.I stacking
subscriptions) to cover the number of sockets, guests, or other characteristics. May not be used with an auto-attach.


.TP
.B --servicelevel=LEVEL
Sets the preferred service level to use with subscriptions automatically attached to the system. Service levels are commonly premium, standard, and none, though other levels may be available depending on the product and the contract. This option cannot be used when attaching specific pools via
.B --pool
or
.B --file.

.SS AUTO-ATTACH OPTIONS
The
.B auto-attach
Expand Down Expand Up @@ -951,10 +902,6 @@ Overall Status: Insufficient
.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.

.TP
.B subscribe
ptoscano marked this conversation as resolved.
Show resolved Hide resolved
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.
Expand Down Expand Up @@ -1070,32 +1017,6 @@ subscription-manager unregister
.fi
.RE

.PP
An option with registration,
.B --auto-attach,
will automatically attach the subscriptions pool which best matches the system architecture and configuration to the newly-registered system. This option attaches subscriptions as part of the registration process, rather than separately managing subscriptions.

.RS
.nf
subscription-manager register --username=admin --password=secret
--auto-attach
.fi
.RE

.PP
Auto-attach also supports an option to set a preferred service level with the selected subscriptions, the
.B --servicelevel
option. In this case, the
.B --servicelevel
option sets a preference that helps the auto-attach process select appropriate subscriptions. For example, if the preferred service level for a production server is premium, and there are three matching subscriptions with different service levels (none, standard, and premium), the auto-attach process selects the subscription which offers a premium service level.

.RS
.nf
subscription-manager register --username=admin --password=secret
--auto-attach --servicelevel=premium
.fi
.RE

.SS LISTING, ATTACHING, AND REMOVING SUBSCRIPTIONS FOR PRODUCTS
A
.I subscription
Expand Down Expand Up @@ -1178,59 +1099,6 @@ Ends: 08/31/2015
.fi
.RE

.PP
Attaching a subscription requires the ID for the subscription pool (the
.I --pool
option). For example:

.RS
.nf
subscription-manager attach
--pool=ff8080812bc382e3012bc3845da100d2
.fi
.RE

.pp
As with the
.B register
command, the system can be auto-attached to the best-fitting subscriptions. This is the default action and is equivalent to using the
.B --auto
option:

.RS
.nf
subscription-manager attach
.fi
.RE


.PP
Auto-attach also supports an option to set a preferred service level with the selected subscriptions, the
.B --servicelevel
option. In this case, the
.B --servicelevel
option sets a preference that helps the auto-attach process select appropriate subscriptions. For example, if the preferred service level for a production server is premium, and there are three matching subscriptions with different service levels (none, standard, and premium), the auto-attach process selects the subscription which offers a premium subscription.

.RS
.nf
subscription-manager attach --servicelevel=premium
.fi
.RE

.PP
Some subscriptions define a count based on attributes of the system itself, like the number of sockets or the number of virtual guests on a host. You can combine multiple subscriptions together to cover the count. For example, if there is a four socket server, you can use two subscriptions for "RHEL Server for Two Sockets" to cover the socket count. To specify the number of subscriptions to use,
use the
.B --quantity
option. For example:

.RS
.nf
subscription-manager attach
--pool=ff8080812bc382e3012bc3845da100d2
--quantity=2
.fi
.RE

.PP
Removing subscription from a system releases the subscription back into the pool. The system remains registered with the subscription management service. Each product has an identifying X.509 certificate installed with it. To remove a subscription for a specific product, specify the serial number (or numbers, in multiple \fB--serial\fP options) of the certificate:

Expand Down Expand Up @@ -1373,7 +1241,7 @@ tool can be run as a post-install script as part of the kickstart installation p
.RS
.nf
%post --log=/root/ks-post.log
/usr/sbin/subscription-manager register --username admin --password secret --org 'east colo' --auto-attach --servicelevel=premium --force
/usr/sbin/subscription-manager register --username admin --password secret --org 'east colo' --force
.fi
.RE

Expand Down
1 change: 0 additions & 1 deletion src/rhsmlib/dbus/objects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from rhsmlib.dbus.objects.config import ConfigDBusObject # NOQA
from rhsmlib.dbus.objects.main import Main # NOQA
from rhsmlib.dbus.objects.register import RegisterDBusObject, DomainSocketRegisterDBusObject # NOQA
from rhsmlib.dbus.objects.attach import AttachDBusObject # NOQA
from rhsmlib.dbus.objects.products import ProductsDBusObject # NOQA
from rhsmlib.dbus.objects.unregister import UnregisterDBusObject # NOQA
from rhsmlib.dbus.objects.entitlement import EntitlementDBusObject # NOQA
Expand Down
141 changes: 0 additions & 141 deletions src/rhsmlib/dbus/objects/attach.py

This file was deleted.

Loading
Loading