Bug 1868734
| Summary: | 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 | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Shwetha Kallesh <skallesh> |
| Component: | subscription-manager | Assignee: | Jiri Hnidek <jhnidek> |
| Status: | CLOSED ERRATA | QA Contact: | Red Hat subscription-manager QE Team <rhsm-qe> |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 8.3 | CC: | csnyder, jhnidek, jsefler, jwboyer, nmoumoul, prakgupt, redakkan, skallesh |
| Target Milestone: | rc | Keywords: | Regression, Triaged |
| Target Release: | 8.3 | Flags: | pm-rhel:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | subscription-manager-1.27.16-1 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-11-04 01:39:45 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1842946 | ||
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
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}}
Also review bug 1875988 which likely requires the same fix as this bug. *** Bug 1875988 has been marked as a duplicate of this bug. *** *** Bug 1875624 has been marked as a duplicate of this bug. *** 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
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
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
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 |
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