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 1868734 - system purpose attributes are not set on the system when you register the system with an activation key that has all the system purpose attributes set on the key
Summary: system purpose attributes are not set on the system when you register the sys...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: subscription-manager
Version: 8.3
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: 8.3
Assignee: Jiri Hnidek
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
: 1875624 1875988 (view as bug list)
Depends On:
Blocks: 1842946
TreeView+ depends on / blocked
 
Reported: 2020-08-13 16:02 UTC by Shwetha Kallesh
Modified: 2021-09-03 15:25 UTC (History)
8 users (show)

Fixed In Version: subscription-manager-1.27.16-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 01:39:45 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 2326 0 None closed 1868734: Fix issue with syspurpose attrs. set in act. key; ENT-2851 2021-02-02 05:44:32 UTC
Red Hat Product Errata RHBA-2020:4460 0 None None None 2020-11-04 01:39:51 UTC

Description Shwetha Kallesh 2020-08-13 16:02:44 UTC
Description of problem:
syspurpose attributes on the activation-key are not set on the system when you register with activation-key that has role,usage and service-level values set on it

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

subscription management server: 3.1.16-1
How reproducible:


Steps to Reproduce:
[root@kvm-01-guest06 ~]# rm -f /var/lib/rhsm/cache/syspurpose.json
[root@kvm-01-guest06 ~]# rm -f /etc/rhsm/syspurpose/syspurpose.json


Create an activation and set role,usage and service-level values on it
[root@kvm-01-guest06 ~]# curl --stderr /dev/null --insecure --user stage_auto_syspurpose001:redhat --request POST --data '{"role":"Red Hat Enterprise Linux Server","usage":"Production","name":"Syspurpose_key_1","serviceLevel":"Self-Support","autoAttach":"true"}' --header 'accept: application/json' --header 'content-type: application/json' https://candlepin.corp.stage.redhat.com/candlepin/owners/12814047/activation_keys
    {"created":"2020-08-13T15:43:19+0000",
    "updated":"2020-08-13T15:43:19+0000",
    "id":"8a99f9a273df349e0173e87d68f65d5b",
    "name":"Syspurpose_key_1",
    "description":null,
    "owner":{"id":"8a99f9ae6e3a9cac016e3b641dbc000f",
            "key":"12814047","displayName":"12814047",
            "href":"/owners/12814047"},
    "serviceLevel":"Self-Support",      --------> note service-level is set 
    "usage":"Production",               --------> note usage is set 
    "role":"Red Hat Enterprise Linux Server",--------> note role is set
    "addOns":[],
    "autoAttach":true,
    "pools":[],
    "contentOverrides":[],
    "products":[],
    "releaseVer":{"releaseVer":null}}

Register with the activation-key created above
 [root@kvm-01-guest06 ~]# subscription-manager register --org=12814047 --activationkey=Syspurpose_key_1 --serverurl subscription.rhsm.stage.redhat.com

The system has been registered with ID: 39971172-7adb-4620-aa2d-3549acf231b6
The registered system name is: kvm-01-guest06.lab.eng.rdu2.redhat.com
Installed Product Current Status:
 Product Name: Red Hat Enterprise Linux for x86_64 High Touch Beta
 Status:       Subscribed
     
 To use Red Hat Insights, install the insights-client package.
 To opt out of Red Hat Insights, run "insights-client --unregister" or reregister with "--no-insights".


[root@kvm-01-guest06 ~]# syspurpose show
{}
^^ observe that syspurpose values from the activation-key are not set on the system


Actual results:
syspurpose values from the activation-key are not set on the system

Expected results:
syspurpose values from the activation-key shouldbe set on the system 

Additional info:
Please see the bug https://bugzilla.redhat.com/show_bug.cgi?id=1775361 , its a re-occurance of old issue

Comment 1 Shwetha Kallesh 2020-08-13 16:25:57 UTC
Activation key with autoAttach set to false:

[root@kvm-01-guest06 ~]# curl --stderr /dev/null --insecure --user stage_auto_syspurpose001:redhat --request POST --data '{"role":"Red Hat Enterprise Linux Server","usage":"Production","name":"Syspurpose_key_2","serviceLevel":"Self-Support","autoAttach":"false"}' --header 'accept: application/json' --header 'content-type: application/json' https://candlepin.corp.stage.redhat.com/candlepin/owners/12814047/activation_keys
{"created":"2020-08-13T16:23:09+0000","updated":"2020-08-13T16:23:09+0000","id":"8a99f9a373df34f30173e8a1deee5ddc","name":"Syspurpose_key_2","description":null,"owner":{"id":"8a99f9ae6e3a9cac016e3b641dbc000f","key":"12814047","displayName":"12814047","href":"/owners/12814047"},"serviceLevel":"Self-Support","usage":"Production","role":"Red Hat Enterprise Linux Server","addOns":[],"autoAttach":false,"pools":[],"contentOverrides":[],"products":[],"releaseVer":{"releaseVer":null}}


Register using above key
[root@kvm-01-guest06subscription-manager register --org=12814047 --activationkey=Syspurpose_key_2 --serverurl subscription.rhsm.stage.redhat.com --force
Unregistering from: subscription.rhsm.stage.redhat.com:443/subscription
The system with UUID 39971172-7adb-4620-aa2d-3549acf231b6 has been unregistered
All local data removed
The system has been registered with ID: 2c46c643-7b09-4af7-8670-730cbc6fc58c
The registered system name is: kvm-01-guest06.lab.eng.rdu2.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64 High Touch Beta
Status:       Not Subscribed

Unable to find available subscriptions for all your installed products.
To use Red Hat Insights, install the insights-client package.
To opt out of Red Hat Insights, run "insights-client --unregister" or reregister with "--no-insights".
[root@kvm-01-guest06 ~]# syspurpose show
{}
^^ observe syspurpose values are not set

Comment 3 Shwetha Kallesh 2020-09-03 09:54:02 UTC
Hey Prakhar,

              I can reproduce with the following version,

[root@ibm-x3650m4-01-vm-13 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.1.18-1
subscription management rules: 5.41
subscription-manager: 1.27.15-1.el8


[root@ibm-x3650m4-01-vm-13 ~]# rm -f /var/lib/rhsm/cache/syspurpose.json
[root@ibm-x3650m4-01-vm-13 ~]# rm -f /etc/rhsm/syspurpose/syspurpose.json
[root@ibm-x3650m4-01-vm-13 ~]# 
[root@ibm-x3650m4-01-vm-13 ~]# syspurpose show
{}
[root@ibm-x3650m4-01-vm-13 ~]# subscription-manager register --org=12814047 --activationkey=Syspurpose_key_1 --serverurl subscription.rhsm.stage.redhat.com
The system has been registered with ID: 5840f7fe-7bcf-4421-8025-fed2f32da99c
The registered system name is: ibm-x3650m4-01-vm-13.ibm2.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64 High Touch Beta
Status:       Subscribed

[root@ibm-x3650m4-01-vm-13 ~]# syspurpose show
{}


The following activationkey is used test:

curl --stderr /dev/null --insecure --user stage_auto_syspurpose001:redhat --request POST --data '{"role":"Red Hat Enterprise Linux Server","usage":"Production","name":"Syspurpose_key_1","serviceLevel":"Self-Support","autoAttach":"true"}' --header 'accept: application/json' --header 'content-type: application/json' https://candlepin.corp.stage.redhat.com/candlepin/owners/12814047/activation_keys
    {"created":"2020-08-13T15:43:19+0000",
    "updated":"2020-08-13T15:43:19+0000",
    "id":"8a99f9a273df349e0173e87d68f65d5b",
    "name":"Syspurpose_key_1",
    "description":null,
    "owner":{"id":"8a99f9ae6e3a9cac016e3b641dbc000f",
            "key":"12814047","displayName":"12814047",
            "href":"/owners/12814047"},
    "serviceLevel":"Self-Support",      --------> note service-level is set 
    "usage":"Production",               --------> note usage is set 
    "role":"Red Hat Enterprise Linux Server",--------> note role is set
    "addOns":[],
    "autoAttach":true,
    "pools":[],
    "contentOverrides":[],
    "products":[],
    "releaseVer":{"releaseVer":null}}

Comment 4 John Sefler 2020-09-07 12:54:22 UTC
Also review bug 1875988 which likely requires the same fix as this bug.

Comment 14 Chris Snyder 2020-09-10 15:00:36 UTC
*** Bug 1875988 has been marked as a duplicate of this bug. ***

Comment 15 Chris Snyder 2020-09-10 15:01:10 UTC
*** Bug 1875624 has been marked as a duplicate of this bug. ***

Comment 18 Shwetha Kallesh 2020-09-16 07:15:16 UTC
Verification: 
[root@ibm-x3650m4-01-vm-14 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.1.19-1
subscription management rules: 5.41
subscription-manager: 1.27.16-1.el8


case1:

[shwetha@localhost ~]$ curl --stderr /dev/null --insecure --user stage_auto_syspurpose001:redhat --request POST --data '{"role":"Red Hat Enterprise Linux Server","usage":"Production","name":"SyspurposeTestKey","serviceLevel":"Self-Support","addOns":["HighAvailability","EUS"],"autoAttach":"true"}' --header 'accept: application/json' --header 'content-type: application/json' https://candlepin.corp.stage.redhat.com/candlepin/owners/12814047/activation_keys | python3 -m json.tool
{
    "created": "2020-09-16T07:05:37+0000",
    "updated": "2020-09-16T07:05:37+0000",
    "id": "8a99f9aa7492e662017495bba73830d5",
    "name": "SyspurposeTestKey",
    "description": null,
    "owner": {
        "id": "8a99f9ae6e3a9cac016e3b641dbc000f",
        "key": "12814047",
        "displayName": "12814047",
        "href": "/owners/12814047"
    },
    "serviceLevel": "Self-Support",               ----------> service-level value on the activation key
    "usage": "Production",                        -----------> Usage value on activation key
    "role": "Red Hat Enterprise Linux Server",    ------------> role value on activation key
    "addOns": [                                   ----------- > addons value on activation key

        "EUS",
        "HighAvailability"
    ],
    "autoAttach": true,
    "pools": [],
    "contentOverrides": [],
    "products": [],
    "releaseVer": {
        "releaseVer": null
    }
}

[root@ibm-x3650m4-01-vm-14 ~]# rm -f /var/lib/rhsm/cache/syspurpose.json
[root@ibm-x3650m4-01-vm-14 ~]# rm -f /etc/rhsm/syspurpose/syspurpose.json


[root@ibm-x3650m4-01-vm-14 ~]# syspurpose show
{}                                                
^^ observe that syspurpose values are not set on the system

[root@ibm-x3650m4-01-vm-14 ~]# subscription-manager register --org=12814047 --activationkey=SyspurposeTestKey --force
Unregistering from: subscription.rhsm.stage.redhat.com:443/subscription
The system with UUID 54d23213-c0f6-45fe-95e5-5f408c6d5830 has been unregistered
All local data removed
The system has been registered with ID: 9622ead3-11b9-4a82-be04-340a6035175f
The registered system name is: ibm-x3650m4-01-vm-14.ibm2.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64 High Touch Beta
Status:       Subscribed

[root@ibm-x3650m4-01-vm-14 ~]# syspurpose show
{
  "addons": [
    "EUS",
    "HighAvailability"
  ],
  "role": "Red Hat Enterprise Linux Server",
  "service_level_agreement": "Self-Support",
  "usage": "Production"
}

^^ all the values of syspurpose attributes present on the activation key are set

Comment 19 Shwetha Kallesh 2020-09-16 07:39:31 UTC
Case2:

Set default sla on the org:
--------------------------------------------------
[shwetha@localhost ~]$ curl --stderr /dev/null --insecure --user testuser1:***** --request PUT --data '{"defaultServiceLevel":"Full-Service"}' --header 'accept: application/json' --header 'content-type: application/json' https://shwetha-workstation.usersys.redhat.com:8443/candlepin/owners/admin | python3 -m json.tool
{
    "created": "2020-09-16T06:50:14+0000",
    "updated": "2020-09-16T07:31:26+0000",
    "id": "8ac6a3417495ad46017495ad942a0004",
    "key": "admin",
    "displayName": "Admin Owner",
    "parentOwner": null,
    "contentPrefix": null,
    "defaultServiceLevel": "Full-Service",          -----------> default sla on the org is Full Service 
    "upstreamConsumer": null,
    "logLevel": null,
    "autobindDisabled": false,
    "autobindHypervisorDisabled": false,
    "contentAccessMode": "entitlement",
    "contentAccessModeList": "entitlement",
    "lastRefreshed": "2020-09-16T06:51:39+0000",
    "href": "/owners/admin"
}

Create an activationkey with sla set to premium:
-------------------------------------------------------------------
[shwetha@localhost ~]$ curl --stderr /dev/null --insecure --user testuser1:****** --request POST --data '{"name":"ak-premium","serviceLevel":"Premium"}' --header 'accept: application/json' --header 'content-type: application/json' https://shwetha-workstation.usersys.redhat.com:8443/candlepin/owners/admin/activation_keys | python3 -m json.tool
{
    "created": "2020-09-16T07:31:43+0000",
    "updated": "2020-09-16T07:31:43+0000",
    "id": "8ac6a3417495b33f017495d38ef20023",
    "name": "ak-premium",
    "description": null,
    "owner": {
        "id": "8ac6a3417495ad46017495ad942a0004",
        "key": "admin",
        "displayName": "Admin Owner",
        "href": "/owners/admin"
    },
    "serviceLevel": "Premium",         -------------> sla is premium on the activation key
    "usage": null,
    "role": null,
    "addOns": [],
    "autoAttach": null,
    "pools": [],
    "contentOverrides": [],
    "products": [],
    "releaseVer": {
        "releaseVer": null
    }
}

[root@ibm-x3650m4-01-vm-14 ~]# rm -f /etc/rhsm/syspurpose/syspurpose.json
[root@ibm-x3650m4-01-vm-14 ~]# rm -f /var/lib/rhsm/cache/syspurpose.json
[root@ibm-x3650m4-01-vm-14 ~]# syspurpose show
{}
^^ no syspurpose attributes are set on the system

[root@ibm-x3650m4-01-vm-14 ~]# subscription-manager register --serverurl=https://shwetha-workstation.usersys.redhat.com:8443/candlepin --activationkey=ak-premium --org=admin --force
The system has been registered with ID: 4c7b668b-b75e-4f02-beff-3615950f0628
The registered system name is: ibm-x3650m4-01-vm-14.ibm2.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64 High Touch Beta
Status:       Not Subscribed

Unable to find available subscriptions for all your installed products.
[root@ibm-x3650m4-01-vm-14 ~]# syspurpose show
{
  "service_level_agreement": "Premium"
}

^^ sla premium(activation key sla) is set on the system which is expected

Comment 20 Shwetha Kallesh 2020-09-16 07:44:07 UTC
Case 3:


Set sla on the system to standard :
----------------------------------------------
[root@ibm-x3650m4-01-vm-14 ~]# syspurpose set-sla standard
Warning: Provided value "standard" is not included in the list of valid values for attribute service_level_agreement:
 - Full-Service
 - Super
 - Premium
 - Standard
 - None
service_level_agreement set to "standard".
[root@ibm-x3650m4-01-vm-14 ~]# syspurpose show
{
  "service_level_agreement": "standard"
}
[root@ibm-x3650m4-01-vm-14 ~]# subscription-manager register --serverurl=https://shwetha-workstation.usersys.redhat.com:8443/candlepin --activationkey=ak-premium --org=admin --force
Unregistering from: shwetha-workstation.usersys.redhat.com:8443/candlepin
The system with UUID 4c7b668b-b75e-4f02-beff-3615950f0628 has been unregistered
All local data removed
The system has been registered with ID: 3b5b3fc3-acb5-4ae4-9041-379063865c0e
The registered system name is: ibm-x3650m4-01-vm-14.ibm2.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64 High Touch Beta
Status:       Not Subscribed

Unable to find available subscriptions for all your installed products.
[root@ibm-x3650m4-01-vm-14 ~]# syspurpose show
{
  "service_level_agreement": "Premium"
}

^^ when there is an sla set on system , sla on the activation key gets preference over default sla of the org and sla which is already set on the system, which is expected

Comment 23 errata-xmlrpc 2020-11-04 01:39:45 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-2020:4460


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