RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2000883 - [RHEL 8.6 ] Backport request for new "syspurpose" modules
Summary: [RHEL 8.6 ] Backport request for new "syspurpose" modules
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: subscription-manager
Version: 8.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: pre-dev-freeze
: 8.6
Assignee: Pino Toscano
QA Contact: Red Hat subscription-manager QE Team
Sagar Dubewar
URL:
Whiteboard:
Depends On:
Blocks: 2000867
TreeView+ depends on / blocked
 
Reported: 2021-09-03 09:49 UTC by Rehana
Modified: 2022-05-10 16:39 UTC (History)
4 users (show)

Fixed In Version: subscription-manager-1.28.24-1.el8
Doc Type: Enhancement
Doc Text:
.Merged system purpose commands under `subscription-manager syspurpose` Previously, there were multiple subscription-manager modules (`addons`, `role`, `service-level`, and `usage`) for setting attributes related to system purpose. These modules have been moved under the new `subscription-manager syspurpose` module. The original subscription-manager modules (`addons`, `role`, `service-level`, and `usage`) are now deprecated. Additionally, the package (`python3-syspurpose`) that provides the `syspurpose` command line tool has been deprecated in RHEL 8.6. All the capabilities of this package are covered by the new `subscription-manager syspurpose` module. This update provides a consistent way to view, set, and update all system purpose attributes using a single command of subscription-manager; this replaces all the existing system purpose commands with their equivalent versions available as a new subcommand. For example, `subscription-manager role --set SystemRole` becomes `subscription-manager syspurpose role --set SystemRole` and so on. For complete information about the new commands, options, and other attributes, see the `SYSPURPOSE OPTIONS` section in the `subscription-manager` man page.
Clone Of:
Environment:
Last Closed: 2022-05-10 15:22:57 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin subscription-manager pull 2745 0 None Merged [1.28] Backport the unified syspurpose command 2021-09-17 13:39:27 UTC
Red Hat Issue Tracker ENT-4068 0 None None None 2021-09-03 09:58:04 UTC
Red Hat Issue Tracker ENT-4303 0 None None None 2021-09-03 10:23:10 UTC
Red Hat Issue Tracker RHELPLAN-96089 0 None None None 2021-09-03 09:51:57 UTC
Red Hat Product Errata RHBA-2022:2047 0 None None None 2022-05-10 15:23:14 UTC

Description Rehana 2021-09-03 09:49:26 UTC
Description of problem:
As discussed in the review meeting , we would like to backport the feature the new "Syspurpose" module in the subscription-manager tool , that was implemented and tracked in Bug 1898563

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.Ability to set system purpose values under the new `subscription-manager syspurpose` 
2.
3.

Actual results:
No `subscription-manager syspurpose` module

Expected results:
`subscription-manager syspurpose` module should exist with all the other sub modules along with it. 

Additional info:

Comment 1 Zdenek Petracek 2021-11-05 11:45:58 UTC
Pre-verified version:
[root@kvm-01-guest06 rhsm]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.21-1
subscription management rules: 5.41
subscription-manager: 1.28.22-1.git.22.9f66a72.el8

Registration:
[root@kvm-01-guest06 rhsm]# subscription-manager register
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: zpetracePH03
Password: 
The system has been registered with ID: f891feba-6a98-4436-b35e-bdcff0589168
The registered system name is: kvm-01-guest06.lab.eng.brq.redhat.com

Pre-verification 1:
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose -h
.
.
.
Syspurpose submodules:
  
    addons              Show or modify the system purpose addons setting
    role                Show or modify the system purpose role setting
    service-level       Show or modify the system purpose service-level
                        setting
    usage               Show or modify the system purpose usage setting

Pre-verification 2:
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --set server
Warning: Provided value "server" is not included in the list of valid values
 - Red Hat Enterprise Linux Server
role set to "server".

Pre-verification 3:
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage --set work
Warning: Provided value "work" is not included in the list of valid values
 - Production
usage set to "work".

Pre-verification 4:
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level --set haha
Warning: Provided value "haha" is not included in the list of valid values
 - Premium
 - Self-Support
service_level_agreement set to "haha".

Pre-verification 5:

[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --add server
Warning: This organization does not have any subscriptions that provide a system purpose "addons".  This setting will not influence auto-attaching subscriptions.
addons updated.

[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --show
Current Addons: server


// I wasn't exactly sure what the right purpose values to set were, so I set the submodules up into random words that came to my mind just too see if you can set it up in the subscription-manager syspurpose

Comment 2 Zdenek Petracek 2021-11-05 12:28:28 UTC
(In reply to Zdenek Petracek from comment #1)
> Pre-verified version:
> [root@kvm-01-guest06 rhsm]# subscription-manager version
> server type: This system is currently not registered.
> subscription management server: 3.2.21-1
> subscription management rules: 5.41
> subscription-manager: 1.28.22-1.git.22.9f66a72.el8
> 
> Registration:
> [root@kvm-01-guest06 rhsm]# subscription-manager register
> Registering to: subscription.rhsm.stage.redhat.com:443/subscription
> Username: zpetracePH03
> Password: 
> The system has been registered with ID: f891feba-6a98-4436-b35e-bdcff0589168
> The registered system name is: kvm-01-guest06.lab.eng.brq.redhat.com
> 
> Pre-verification 1:
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose -h
> .
> .
> .
> Syspurpose submodules:
>   
>     addons              Show or modify the system purpose addons setting
>     role                Show or modify the system purpose role setting
>     service-level       Show or modify the system purpose service-level
>                         setting
>     usage               Show or modify the system purpose usage setting
> 
> Pre-verification 2:
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --set server
> Warning: Provided value "server" is not included in the list of valid values
>  - Red Hat Enterprise Linux Server
> role set to "server".
> 
> Pre-verification 3:
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage --set work
> Warning: Provided value "work" is not included in the list of valid values
>  - Production
> usage set to "work".
> 
> Pre-verification 4:
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level
> --set haha
> Warning: Provided value "haha" is not included in the list of valid values
>  - Premium
>  - Self-Support
> service_level_agreement set to "haha".
> 
> Pre-verification 5:
> 
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --add
> server
> Warning: This organization does not have any subscriptions that provide a
> system purpose "addons".  This setting will not influence auto-attaching
> subscriptions.
> addons updated.
> 
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --show
> Current Addons: server
> 
> 
> // I wasn't exactly sure what the right purpose values to set were, so I set
> the submodules up into random words that came to my mind just too see if you
> can set it up in the subscription-manager syspurpose

Pre-verification 6 - List system purpose values on a unregistered system with-without credentials:
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --list
Error: you must register or specify --username and --password to list role
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage --list
Error: you must register or specify --username and --password to list usage
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level --list
Error: you must register or specify --username and --password to list service levels
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --list
Error: you must register or specify --username and --password to list addons

[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --list --username=zpetracePH03 --password=*****
+-------------------------------------------+
               Available role
+-------------------------------------------+
 - Red Hat Enterprise Linux Server
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage --list --username=zpetracePH03 --password=*****
+-------------------------------------------+
               Available usage
+-------------------------------------------+
 - Production
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level --list --username=zpetracePH03 --password=*****
+-------------------------------------------+
           Available Service Levels
+-------------------------------------------+
Premium
Self-Support
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --list --username=zpetracePH03 --password=*****
There are no available values for the system purpose "addons" from the available subscriptions in this organization.

Pre-verification 7 - Show set system purpose values set under each module:
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --show ; subscription-manager syspurpose usage --show ; subscription-manager syspurpose service-level --show ; subscription-manager syspurpose addons --show
Current Role: server
Current Usage: work
Current Service-level: haha
Current Addons: server

Pre-verification 8 - Unset system purpose values on a unregistered system:
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --unset; subscription-manager syspurpose --show
role unset.
{
  "addons": [
    "server"
  ],
  "service_level_agreement": "haha",
  "usage": "work"
}
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage --unset; subscription-manager syspurpose --show
usage unset.
{
  "addons": [
    "server"
  ],
  "service_level_agreement": "haha"
}
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level --unset; subscription-manager syspurpose --show
service_level_agreement unset.
{
  "addons": [
    "server"
  ]
}
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --unset; subscription-manager syspurpose --show
addons unset.
{}

Pre-verification 9 - Set values using credentials:
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --set="Red Hat Enterprise Linux Server" --username=zpetracePH03 --password=*****
role set to "Red Hat Enterprise Linux Server".
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage --set="Production" --username=zpetracePH03 --password=*****
usage set to "Production".
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level --set="Premium" --username=zpetracePH03 --password=*****
service_level_agreement set to "Premium".
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --add="High Availability" --username=zpetracePH03 --password=*****
Warning: This organization does not have any subscriptions that provide a system purpose "addons".  This setting will not influence auto-attaching subscriptions.
addons updated.

Pre-verification 10 - Register the system and make sure the set values from #9 is persisting:
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose --show
{
  "addons": [
    "High Availability"
  ],
  "role": "Red Hat Enterprise Linux Server",
  "service_level_agreement": "Premium",
  "usage": "Production"
}

Pre-verification 11 - Adding and removing addons on registered system:
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --add="sample" --add="addons"
Warning: This organization does not have any subscriptions that provide a system purpose "addons".  This setting will not influence auto-attaching subscriptions.
addons updated.
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --show
Current Addons: High Availability, addons, sample

[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --remove="sample"
Addons updated.
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --show
Current Addons: High Availability, addons

Pre-verification 12 - Unset system purpose values on a registered system:
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --unset; subscription-manager syspurpose usage --unset ; subscription-manager syspurpose service-level --unset ; subscription-manager addons --unset ; subscription-manager syspurpose --show
role unset.
usage unset.
service_level_agreement unset.
addons unset.
{
  "addons": [],
  "role": "",
  "service_level_agreement": "",
  "usage": ""
}

Pre-verification 13 - set system purpose values on a registered system using proxy details:
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --set="foo" --proxy=auto-services.usersys.redhat.com:3127 --proxyuser=redhat --proxypassword=redhat ; subscription-manager syspurpose --show
Warning: Provided value "foo" is not included in the list of valid values
 - Red Hat Enterprise Linux Server
role set to "foo".
{
  "addons": [],
  "role": "foo",
  "service_level_agreement": "",
  "usage": ""
}
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage --set="QA" --proxy=auto-services.usersys.redhat.com:3127 --proxyuser=redhat --proxypassword=redhat ; subscription-manager syspurpose --show
Warning: Provided value "QA" is not included in the list of valid values
 - Production
usage set to "QA".
{
  "addons": [],
  "role": "foo",
  "service_level_agreement": "",
  "usage": "QA"
}
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level --set="Premium" --proxy=auto-services.usersys.redhat.com:3127 --proxyuser=redhat --proxypassword=redhat ; subscription-manager syspurpose --show
service_level_agreement set to "Premium".
{
  "addons": [],
  "role": "foo",
  "service_level_agreement": "Premium",
  "usage": "QA"
}
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --add=HA --proxy=auto-services.usersys.redhat.com:3127 --proxyuser=redhat --proxypassword=redhat ; subscription-manager syspurpose --show
Warning: This organization does not have any subscriptions that provide a system purpose "addons".  This setting will not influence auto-attaching subscriptions.
addons updated.
{
  "addons": [
    "HA"
  ],
  "role": "foo",
  "service_level_agreement": "Premium",
  "usage": "QA"
}

Pre-verification 14 - Verifying the syntax and man pages entries:
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role -h
usage: subscription-manager syspurpose role [OPTIONS]

Show or modify the system purpose role setting

optional arguments:
  -h, --help            show this help message and exit
  --proxy PROXY_URL     proxy URL in the form of hostname:port
  --proxyuser PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --noproxy NO_PROXY    host suffixes that should bypass HTTP proxy
  --username USERNAME   username to use when authorizing against the server
  --password PASSWORD   password to use when authorizing against the server
  --token TOKEN         token to use when authorizing against the server
  --org ORG_KEY         specify an organization
  --set SET             set role of system purpose
  --unset               unset role of system purpose
  --show                show this system's current role
  --list                list all role available
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage -h
usage: subscription-manager syspurpose usage [OPTIONS]

Show or modify the system purpose usage setting

optional arguments:
  -h, --help            show this help message and exit
  --proxy PROXY_URL     proxy URL in the form of hostname:port
  --proxyuser PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --noproxy NO_PROXY    host suffixes that should bypass HTTP proxy
  --username USERNAME   username to use when authorizing against the server
  --password PASSWORD   password to use when authorizing against the server
  --token TOKEN         token to use when authorizing against the server
  --org ORG_KEY         specify an organization
  --set SET             set usage of system purpose
  --unset               unset usage of system purpose
  --show                show this system's current usage
  --list                list all usage available
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level -h
usage: subscription-manager syspurpose service-level [OPTIONS]

Show or modify the system purpose service-level setting

optional arguments:
  -h, --help            show this help message and exit
  --proxy PROXY_URL     proxy URL in the form of hostname:port
  --proxyuser PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --noproxy NO_PROXY    host suffixes that should bypass HTTP proxy
  --username USERNAME   username to use when authorizing against the server
  --password PASSWORD   password to use when authorizing against the server
  --token TOKEN         token to use when authorizing against the server
  --org ORG_KEY         specify an organization
  --set SET             set service_level_agreement of system purpose
  --unset               unset service_level_agreement of system purpose
  --show                show this system's current service_level_agreement
  --list                list all service_level_agreement available
  --serverurl SERVER_URL
                        server URL in the form of https://hostname:port/prefix
  --insecure            do not check the entitlement server SSL certificate
                        against available certificate authorities
[root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons -h
usage: subscription-manager syspurpose addons [OPTIONS]

Show or modify the system purpose addons setting

optional arguments:
  -h, --help            show this help message and exit
  --proxy PROXY_URL     proxy URL in the form of hostname:port
  --proxyuser PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --noproxy NO_PROXY    host suffixes that should bypass HTTP proxy
  --username USERNAME   username to use when authorizing against the server
  --password PASSWORD   password to use when authorizing against the server
  --token TOKEN         token to use when authorizing against the server
  --org ORG_KEY         specify an organization
  --unset               unset addons of system purpose
  --add TO_ADD          add an item to the list (addons).
  --remove TO_REMOVE    remove an item from the list (addons).
  --show                show this system's current addons
  --list                list all addons available

Comment 3 Zdenek Petracek 2021-11-08 12:16:04 UTC
(In reply to Zdenek Petracek from comment #2)
> (In reply to Zdenek Petracek from comment #1)
> > Pre-verified version:
> > [root@kvm-01-guest06 rhsm]# subscription-manager version
> > server type: This system is currently not registered.
> > subscription management server: 3.2.21-1
> > subscription management rules: 5.41
> > subscription-manager: 1.28.22-1.git.22.9f66a72.el8
> > 
> > Registration:
> > [root@kvm-01-guest06 rhsm]# subscription-manager register
> > Registering to: subscription.rhsm.stage.redhat.com:443/subscription
> > Username: zpetracePH03
> > Password: 
> > The system has been registered with ID: f891feba-6a98-4436-b35e-bdcff0589168
> > The registered system name is: kvm-01-guest06.lab.eng.brq.redhat.com
> > 
> > Pre-verification 1:
> > [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose -h
> > .
> > .
> > .
> > Syspurpose submodules:
> >   
> >     addons              Show or modify the system purpose addons setting
> >     role                Show or modify the system purpose role setting
> >     service-level       Show or modify the system purpose service-level
> >                         setting
> >     usage               Show or modify the system purpose usage setting
> > 
> > Pre-verification 2:
> > [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --set server
> > Warning: Provided value "server" is not included in the list of valid values
> >  - Red Hat Enterprise Linux Server
> > role set to "server".
> > 
> > Pre-verification 3:
> > [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage --set work
> > Warning: Provided value "work" is not included in the list of valid values
> >  - Production
> > usage set to "work".
> > 
> > Pre-verification 4:
> > [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level
> > --set haha
> > Warning: Provided value "haha" is not included in the list of valid values
> >  - Premium
> >  - Self-Support
> > service_level_agreement set to "haha".
> > 
> > Pre-verification 5:
> > 
> > [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --add
> > server
> > Warning: This organization does not have any subscriptions that provide a
> > system purpose "addons".  This setting will not influence auto-attaching
> > subscriptions.
> > addons updated.
> > 
> > [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --show
> > Current Addons: server
> > 
> > 
> > // I wasn't exactly sure what the right purpose values to set were, so I set
> > the submodules up into random words that came to my mind just too see if you
> > can set it up in the subscription-manager syspurpose
> 
> Pre-verification 6 - List system purpose values on a unregistered system
> with-without credentials:
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --list
> Error: you must register or specify --username and --password to list role
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage --list
> Error: you must register or specify --username and --password to list usage
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level
> --list
> Error: you must register or specify --username and --password to list
> service levels
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --list
> Error: you must register or specify --username and --password to list addons
> 
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --list
> --username=zpetracePH03 --password=*****
> +-------------------------------------------+
>                Available role
> +-------------------------------------------+
>  - Red Hat Enterprise Linux Server
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage --list
> --username=zpetracePH03 --password=*****
> +-------------------------------------------+
>                Available usage
> +-------------------------------------------+
>  - Production
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level
> --list --username=zpetracePH03 --password=*****
> +-------------------------------------------+
>            Available Service Levels
> +-------------------------------------------+
> Premium
> Self-Support
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --list
> --username=zpetracePH03 --password=*****
> There are no available values for the system purpose "addons" from the
> available subscriptions in this organization.
> 
> Pre-verification 7 - Show set system purpose values set under each module:
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --show ;
> subscription-manager syspurpose usage --show ; subscription-manager
> syspurpose service-level --show ; subscription-manager syspurpose addons
> --show
> Current Role: server
> Current Usage: work
> Current Service-level: haha
> Current Addons: server
> 
> Pre-verification 8 - Unset system purpose values on a unregistered system:
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --unset;
> subscription-manager syspurpose --show
> role unset.
> {
>   "addons": [
>     "server"
>   ],
>   "service_level_agreement": "haha",
>   "usage": "work"
> }
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage --unset;
> subscription-manager syspurpose --show
> usage unset.
> {
>   "addons": [
>     "server"
>   ],
>   "service_level_agreement": "haha"
> }
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level
> --unset; subscription-manager syspurpose --show
> service_level_agreement unset.
> {
>   "addons": [
>     "server"
>   ]
> }
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --unset;
> subscription-manager syspurpose --show
> addons unset.
> {}
> 
> Pre-verification 9 - Set values using credentials:
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --set="Red
> Hat Enterprise Linux Server" --username=zpetracePH03 --password=*****
> role set to "Red Hat Enterprise Linux Server".
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage
> --set="Production" --username=zpetracePH03 --password=*****
> usage set to "Production".
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level
> --set="Premium" --username=zpetracePH03 --password=*****
> service_level_agreement set to "Premium".
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons
> --add="High Availability" --username=zpetracePH03 --password=*****
> Warning: This organization does not have any subscriptions that provide a
> system purpose "addons".  This setting will not influence auto-attaching
> subscriptions.
> addons updated.
> 
> Pre-verification 10 - Register the system and make sure the set values from
> #9 is persisting:
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose --show
> {
>   "addons": [
>     "High Availability"
>   ],
>   "role": "Red Hat Enterprise Linux Server",
>   "service_level_agreement": "Premium",
>   "usage": "Production"
> }
> 
> Pre-verification 11 - Adding and removing addons on registered system:
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons
> --add="sample" --add="addons"
> Warning: This organization does not have any subscriptions that provide a
> system purpose "addons".  This setting will not influence auto-attaching
> subscriptions.
> addons updated.
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --show
> Current Addons: High Availability, addons, sample
> 
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons
> --remove="sample"
> Addons updated.
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --show
> Current Addons: High Availability, addons
> 
> Pre-verification 12 - Unset system purpose values on a registered system:
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --unset;
> subscription-manager syspurpose usage --unset ; subscription-manager
> syspurpose service-level --unset ; subscription-manager addons --unset ;
> subscription-manager syspurpose --show
> role unset.
> usage unset.
> service_level_agreement unset.
> addons unset.
> {
>   "addons": [],
>   "role": "",
>   "service_level_agreement": "",
>   "usage": ""
> }
> 
> Pre-verification 13 - set system purpose values on a registered system using
> proxy details:
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role --set="foo"
> --proxy=auto-services.usersys.redhat.com:3127 --proxyuser=redhat
> --proxypassword=redhat ; subscription-manager syspurpose --show
> Warning: Provided value "foo" is not included in the list of valid values
>  - Red Hat Enterprise Linux Server
> role set to "foo".
> {
>   "addons": [],
>   "role": "foo",
>   "service_level_agreement": "",
>   "usage": ""
> }
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage --set="QA"
> --proxy=auto-services.usersys.redhat.com:3127 --proxyuser=redhat
> --proxypassword=redhat ; subscription-manager syspurpose --show
> Warning: Provided value "QA" is not included in the list of valid values
>  - Production
> usage set to "QA".
> {
>   "addons": [],
>   "role": "foo",
>   "service_level_agreement": "",
>   "usage": "QA"
> }
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level
> --set="Premium" --proxy=auto-services.usersys.redhat.com:3127
> --proxyuser=redhat --proxypassword=redhat ; subscription-manager syspurpose
> --show
> service_level_agreement set to "Premium".
> {
>   "addons": [],
>   "role": "foo",
>   "service_level_agreement": "Premium",
>   "usage": "QA"
> }
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons --add=HA
> --proxy=auto-services.usersys.redhat.com:3127 --proxyuser=redhat
> --proxypassword=redhat ; subscription-manager syspurpose --show
> Warning: This organization does not have any subscriptions that provide a
> system purpose "addons".  This setting will not influence auto-attaching
> subscriptions.
> addons updated.
> {
>   "addons": [
>     "HA"
>   ],
>   "role": "foo",
>   "service_level_agreement": "Premium",
>   "usage": "QA"
> }
> 
> Pre-verification 14 - Verifying the syntax and man pages entries:
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose role -h
> usage: subscription-manager syspurpose role [OPTIONS]
> 
> Show or modify the system purpose role setting
> 
> optional arguments:
>   -h, --help            show this help message and exit
>   --proxy PROXY_URL     proxy URL in the form of hostname:port
>   --proxyuser PROXY_USER
>                         user for HTTP proxy with basic authentication
>   --proxypassword PROXY_PASSWORD
>                         password for HTTP proxy with basic authentication
>   --noproxy NO_PROXY    host suffixes that should bypass HTTP proxy
>   --username USERNAME   username to use when authorizing against the server
>   --password PASSWORD   password to use when authorizing against the server
>   --token TOKEN         token to use when authorizing against the server
>   --org ORG_KEY         specify an organization
>   --set SET             set role of system purpose
>   --unset               unset role of system purpose
>   --show                show this system's current role
>   --list                list all role available
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose usage -h
> usage: subscription-manager syspurpose usage [OPTIONS]
> 
> Show or modify the system purpose usage setting
> 
> optional arguments:
>   -h, --help            show this help message and exit
>   --proxy PROXY_URL     proxy URL in the form of hostname:port
>   --proxyuser PROXY_USER
>                         user for HTTP proxy with basic authentication
>   --proxypassword PROXY_PASSWORD
>                         password for HTTP proxy with basic authentication
>   --noproxy NO_PROXY    host suffixes that should bypass HTTP proxy
>   --username USERNAME   username to use when authorizing against the server
>   --password PASSWORD   password to use when authorizing against the server
>   --token TOKEN         token to use when authorizing against the server
>   --org ORG_KEY         specify an organization
>   --set SET             set usage of system purpose
>   --unset               unset usage of system purpose
>   --show                show this system's current usage
>   --list                list all usage available
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose service-level -h
> usage: subscription-manager syspurpose service-level [OPTIONS]
> 
> Show or modify the system purpose service-level setting
> 
> optional arguments:
>   -h, --help            show this help message and exit
>   --proxy PROXY_URL     proxy URL in the form of hostname:port
>   --proxyuser PROXY_USER
>                         user for HTTP proxy with basic authentication
>   --proxypassword PROXY_PASSWORD
>                         password for HTTP proxy with basic authentication
>   --noproxy NO_PROXY    host suffixes that should bypass HTTP proxy
>   --username USERNAME   username to use when authorizing against the server
>   --password PASSWORD   password to use when authorizing against the server
>   --token TOKEN         token to use when authorizing against the server
>   --org ORG_KEY         specify an organization
>   --set SET             set service_level_agreement of system purpose
>   --unset               unset service_level_agreement of system purpose
>   --show                show this system's current service_level_agreement
>   --list                list all service_level_agreement available
>   --serverurl SERVER_URL
>                         server URL in the form of
> https://hostname:port/prefix
>   --insecure            do not check the entitlement server SSL certificate
>                         against available certificate authorities
> [root@kvm-01-guest06 rhsm]# subscription-manager syspurpose addons -h
> usage: subscription-manager syspurpose addons [OPTIONS]
> 
> Show or modify the system purpose addons setting
> 
> optional arguments:
>   -h, --help            show this help message and exit
>   --proxy PROXY_URL     proxy URL in the form of hostname:port
>   --proxyuser PROXY_USER
>                         user for HTTP proxy with basic authentication
>   --proxypassword PROXY_PASSWORD
>                         password for HTTP proxy with basic authentication
>   --noproxy NO_PROXY    host suffixes that should bypass HTTP proxy
>   --username USERNAME   username to use when authorizing against the server
>   --password PASSWORD   password to use when authorizing against the server
>   --token TOKEN         token to use when authorizing against the server
>   --org ORG_KEY         specify an organization
>   --unset               unset addons of system purpose
>   --add TO_ADD          add an item to the list (addons).
>   --remove TO_REMOVE    remove an item from the list (addons).
>   --show                show this system's current addons
>   --list                list all addons available

Pre-verification 15 - man subscription-manager syspurpose:

man page shows:
SYSPURPOSE OPTIONS
       The syspurpose command displays the current configured syspurpose preferences for the system.

       The syspurpose command has subcommands for all the various syspurpose preferences and attributes:

              1. addons

              2. role

              3. service-level

              4. usage

       --show Shows  the  system's  current  set  of  syspurpose preference. This is output in the form of a blob of json. Single-valued
              entries for which there is no value will be included in the output with a value of "". List entries which  have  no  value
              will be included in the output with a value of "[]" (less the quotes).
// addons, role, service-level and usage options are described in man page as well

Comment 7 Zdenek Petracek 2021-11-25 13:13:01 UTC
Version:
[root@kvm-01-guest08 rhsm]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.21-1
subscription management rules: 5.41
subscription-manager: 1.28.24-1.el8

Registering:
[root@kvm-01-guest08 rhsm]# subscription-manager register
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: zpetracePH03
Password: 
The system has been registered with ID: c96e337e-afe3-4562-89a1-487e3522f813
The registered system name is: kvm-01-guest08.lab.eng.brq.redhat.com

Verification 1 - Setting up submodule values on registered system:
[root@kvm-01-guest08 rhsm]# subscription-manager syspurpose role --set "Red Hat Enterprise Linux Server"
role set to "Red Hat Enterprise Linux Server".

[root@kvm-01-guest08 rhsm]# subscription-manager syspurpose usage --set=Production
usage set to "Production".

[root@kvm-01-guest08 rhsm]# subscription-manager syspurpose addons --add="High Availability"
Warning: This organization does not have any subscriptions that provide a system purpose "addons".  This setting will not influence auto-attaching subscriptions.
addons updated.

[root@kvm-01-guest08 rhsm]# subscription-manager syspurpose service-level --set="Premium"
service_level_agreement set to "Premium".
--> PASSED

Verification 2 - Showing values for each submodule:
[root@kvm-01-guest08 rhsm]# subscription-manager syspurpose role --show ; subscription-manager syspurpose usage --show ; subscription-manager syspurpose service-level --show ; subscription-manager syspurpose addons --show
Current Role: Red Hat Enterprise Linux Server
Current Usage: Production
Current Addons: High Availability
Current service level: Premium
--> PASSED

Verification 3 - Listing syspurpose values on unregistered system:
[root@kvm-01-guest08 ~]# subscription-manager unregister
Unregistering from: subscription.rhsm.stage.redhat.com:443/subscription
System has been unregistered.

[root@kvm-01-guest08 ~]# subscription-manager syspurpose role --list
Error: you must register or specify --username and --password to list role
[root@kvm-01-guest08 ~]# subscription-manager syspurpose usage --list
Error: you must register or specify --username and --password to list usage
[root@kvm-01-guest08 ~]# subscription-manager syspurpose addons --list
Error: you must register or specify --username and --password to list addons
[root@kvm-01-guest08 ~]# subscription-manager syspurpose service-level --list
Error: you must register or specify --username and --password to list service levels
--> PASSED

Verification 4 - Listing syspurpose values on unregistered system using credentials:
[root@kvm-01-guest08 ~]# subscription-manager syspurpose role --list --username=zpetracePH03 --password=******
+-------------------------------------------+
               Available role
+-------------------------------------------+
 - Red Hat Enterprise Linux Server
[root@kvm-01-guest08 ~]# subscription-manager syspurpose usage --list --username=zpetracePH03 --password=*****
+-------------------------------------------+
               Available usage
+-------------------------------------------+
 - Production
[root@kvm-01-guest08 ~]# subscription-manager syspurpose addons --list --username=zpetracePH03 --password=*****
There are no available values for the system purpose "addons" from the available subscriptions in this organization.
[root@kvm-01-guest08 ~]# subscription-manager syspurpose service-level --list --username=zpetracePH03 --password=*****
+-------------------------------------------+
           Available Service Levels
+-------------------------------------------+
Premium
Self-Support
--> PASSED

Verification 5 - Unset system purpose values on a unregistered system:
[root@kvm-01-guest08 ~]# subscription-manager syspurpose role --unset ; subscription-manager syspurpose --show
role unset.
{
  "addons": [
    "High Availability"
  ],
  "service_level_agreement": "Premium",
  "usage": "Production"
}
[root@kvm-01-guest08 ~]# subscription-manager syspurpose usage --unset ; subscription-manager syspurpose --show
usage unset.
{
  "addons": [
    "High Availability"
  ],
  "service_level_agreement": "Premium"
}
[root@kvm-01-guest08 ~]# subscription-manager syspurpose service-level --unset ; subscription-manager syspurpose --show
service_level_agreement unset.
{
  "addons": [
    "High Availability"
  ]
}
[root@kvm-01-guest08 ~]# subscription-manager syspurpose addons --unset ; subscription-manager syspurpose --show
addons unset.
{}
--> PASSED

Verification 6 - Setting values using credentials:
[root@kvm-01-guest08 ~]# subscription-manager syspurpose role --set="Red Hat Enterprise Linux Server" --username=zpetracePH03 --password=****
role set to "Red Hat Enterprise Linux Server".
[root@kvm-01-guest08 ~]# subscription-manager syspurpose usage --set="Production" --username=zpetracePH03 --password=****
usage set to "Production".
[root@kvm-01-guest08 ~]# subscription-manager syspurpose service-level --set="Premium" --username=zpetracePH03 --password=****
service_level_agreement set to "Premium".
[root@kvm-01-guest08 ~]# subscription-manager syspurpose addons --add="High Availability" --username=zpetracePH03 --password=****
Warning: This organization does not have any subscriptions that provide a system purpose "addons".  This setting will not influence auto-attaching subscriptions.
addons updated.
--> PASSED

Verification 7 - checking if the values persist after registering a system:
[root@kvm-01-guest08 ~]# subscription-manager register
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: zpetracePH03
Password: 
The system has been registered with ID: c73d46b2-6fd2-47aa-892e-e08344a939b1
The registered system name is: kvm-01-guest08.lab.eng.brq.redhat.com

[root@kvm-01-guest08 ~]# subscription-manager syspurpose role --show
Current Role: Red Hat Enterprise Linux Server
[root@kvm-01-guest08 ~]# subscription-manager syspurpose addons --show
Current Addons: High Availability
[root@kvm-01-guest08 ~]# subscription-manager syspurpose usage --show
Current Usage: Production
[root@kvm-01-guest08 ~]# subscription-manager syspurpose service-level --show
Current service level: Premium
--> PASSED

Verification 8 - Adding and removing addons on registered system:
[root@kvm-01-guest08 ~]# subscription-manager syspurpose addons --add="sample" --add="addons"
Warning: This organization does not have any subscriptions that provide a system purpose "addons".  This setting will not influence auto-attaching subscriptions.
addons updated.
[root@kvm-01-guest08 ~]# subscription-manager syspurpose addons --show
Current Addons: High Availability, addons, sample
[root@kvm-01-guest08 ~]# subscription-manager syspurpose addons --remove="sample"
Addons updated.
[root@kvm-01-guest08 ~]# subscription-manager syspurpose addons --show
Current Addons: High Availability, addons
--> PASSED

Verification 9 - Unset syspurpose values on registered system:
[root@kvm-01-guest08 ~]# subscription-manager syspurpose role --unset ; subscription-manager syspurpose usage --unset ; subscription-manager syspurpose service-level --unset ; subscription-manager syspurpose addons --unset
role unset.
usage unset.
service_level_agreement unset.
addons unset.

[root@kvm-01-guest08 ~]# subscription-manager syspurpose role --show ; subscription-manager syspurpose addons --show ; subscription-manager syspurpose service-level --show ; subscription-manager syspurpose usage --show
Role not set.
Addons not set.
Service level preference not set
Usage not set.
--> PASSED

Verification 10 - Set system purpose values on a registered system using proxy details:
[root@kvm-01-guest08 ~]# subscription-manager syspurpose role --set="foo" --proxy=auto-services.usersys.redhat.com:3127 --proxyuser=redhat --proxypassword=redhat ; subscription-manager syspurpose --show
Warning: Provided value "foo" is not included in the list of valid values
 - Red Hat Enterprise Linux Server
role set to "foo".
{
  "addons": [],
  "role": "foo",
  "service_level_agreement": "",
  "usage": ""
}
[root@kvm-01-guest08 ~]# subscription-manager syspurpose usage --set="QA" --proxy=auto-services.usersys.redhat.com:3127 --proxyuser=redhat --proxypassword=redhat ; subscription-manager syspurpose --show
Warning: Provided value "QA" is not included in the list of valid values
 - Production
usage set to "QA".
{
  "addons": [],
  "role": "foo",
  "service_level_agreement": "",
  "usage": "QA"
}
[root@kvm-01-guest08 ~]# subscription-manager syspurpose service-level --set="Premium" --proxy=auto-services.usersys.redhat.com:3127 --proxyuser=redhat --proxypassword=redhat ; subscription-manager syspurpose --show
service_level_agreement set to "Premium".
{
  "addons": [],
  "role": "foo",
  "service_level_agreement": "Premium",
  "usage": "QA"
}
[root@kvm-01-guest08 ~]# subscription-manager syspurpose addons --add=HA --proxy=auto-services.usersys.redhat.com:3127 --proxyuser=redhat --proxypassword=redhat ; subscription-manager syspurpose --show
Warning: This organization does not have any subscriptions that provide a system purpose "addons".  This setting will not influence auto-attaching subscriptions.
addons updated.
{
  "addons": [
    "HA"
  ],
  "role": "foo",
  "service_level_agreement": "Premium",
  "usage": "QA"
}
--> PASSED

Verification 11 - Verifying the syntax and man pages entries:
[root@kvm-01-guest08 ~]# subscription-manager syspurpose role -h
usage: subscription-manager syspurpose role [OPTIONS]

Show or modify the system purpose role setting

optional arguments:
  -h, --help            show this help message and exit
  --proxy PROXY_URL     proxy URL in the form of hostname:port
  --proxyuser PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --noproxy NO_PROXY    host suffixes that should bypass HTTP proxy
  --username USERNAME   username to use when authorizing against the server
  --password PASSWORD   password to use when authorizing against the server
  --token TOKEN         token to use when authorizing against the server
  --org ORG_KEY         specify an organization
  --set SET             set role of system purpose
  --unset               unset role of system purpose
  --show                show this system's current role
  --list                list all role available
[root@kvm-01-guest08 ~]# subscription-manager syspurpose usage -h
usage: subscription-manager syspurpose usage [OPTIONS]

Show or modify the system purpose usage setting

optional arguments:
  -h, --help            show this help message and exit
  --proxy PROXY_URL     proxy URL in the form of hostname:port
  --proxyuser PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --noproxy NO_PROXY    host suffixes that should bypass HTTP proxy
  --username USERNAME   username to use when authorizing against the server
  --password PASSWORD   password to use when authorizing against the server
  --token TOKEN         token to use when authorizing against the server
  --org ORG_KEY         specify an organization
  --set SET             set usage of system purpose
  --unset               unset usage of system purpose
  --show                show this system's current usage
  --list                list all usage available
[root@kvm-01-guest08 ~]# subscription-manager syspurpose service-level -h
usage: subscription-manager syspurpose service-level [OPTIONS]

Show or modify the system purpose service-level setting

optional arguments:
  -h, --help            show this help message and exit
  --proxy PROXY_URL     proxy URL in the form of hostname:port
  --proxyuser PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --noproxy NO_PROXY    host suffixes that should bypass HTTP proxy
  --username USERNAME   username to use when authorizing against the server
  --password PASSWORD   password to use when authorizing against the server
  --token TOKEN         token to use when authorizing against the server
  --org ORG_KEY         specify an organization
  --set SET             set service_level_agreement of system purpose
  --unset               unset service_level_agreement of system purpose
  --show                show this system's current service_level_agreement
  --list                list all service_level_agreement available
  --serverurl SERVER_URL
                        server URL in the form of https://hostname:port/prefix
  --insecure            do not check the entitlement server SSL certificate
                        against available certificate authorities
[root@kvm-01-guest08 ~]# subscription-manager syspurpose addons -h
usage: subscription-manager syspurpose addons [OPTIONS]

Show or modify the system purpose addons setting

optional arguments:
  -h, --help            show this help message and exit
  --proxy PROXY_URL     proxy URL in the form of hostname:port
  --proxyuser PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --noproxy NO_PROXY    host suffixes that should bypass HTTP proxy
  --username USERNAME   username to use when authorizing against the server
  --password PASSWORD   password to use when authorizing against the server
  --token TOKEN         token to use when authorizing against the server
  --org ORG_KEY         specify an organization
  --unset               unset addons of system purpose
  --add TO_ADD          add an item to the list (addons).
  --remove TO_REMOVE    remove an item from the list (addons).
  --show                show this system's current addons
  --list                list all addons available
--> PASSED

Verification 12 - man page:
man page shows:
SYSPURPOSE OPTIONS
       The syspurpose command displays the current configured syspurpose preferences for the system.

       The syspurpose command has subcommands for all the various syspurpose preferences and attributes:

              1. addons

              2. role

              3. service-level

              4. usage

       --show Shows  the  system's  current  set  of  syspurpose preference. This is output in the form of a blob of json. Single-valued
              entries for which there is no value will be included in the output with a value of "". List entries which  have  no  value
              will be included in the output with a value of "[]" (less the quotes).
// addons, role, service-level and usage options are described in man page as well
--> PASSED

Comment 11 errata-xmlrpc 2022-05-10 15:22:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (subscription-manager bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:2047


Note You need to log in before you can comment on or make changes to this bug.