Bug 1661107

Summary: syspurpose can not set service level
Product: Red Hat Enterprise Linux 8 Reporter: qianzhan
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED DUPLICATE QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: cdonnell, khowell, sgao, yanpliu
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-14 15:27:16 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:

Description qianzhan 2018-12-20 06:51:18 UTC
Description of problem:
syspurpose can not set service level

Version-Release number of selected component (if applicable):
python3-subscription-manager-rhsm-1.23.8-11.el8.x86_64
subscription-manager-rhsm-certificates-1.23.8-11.el8.x86_64
dnf-plugin-subscription-manager-1.23.8-11.el8.x86_64
subscription-manager-1.23.8-11.el8.x86_64
katello-3.10.0-0.6.rc1.el7sat.noarch
tfm-rubygem-katello-3.10.0-0.3.rc1.1.el7sat.noarch
candlepin-2.5.8-1.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. Register RHEL-8.0-20181218.0 against Satellite6.5-snapshot8.0:

[root@dell-r730-001-guest22 ~]# subscription-manager  register
Registering to: ibm-hs22-04.rhts.eng.brq.redhat.com:443/rhsm
Username: admin
Password: 
The system has been registered with ID: ae4dba3f-e1e8-47cb-9896-68a8352a973f
The registered system name is: dell-r730-001-guest22.dsal.lab.eng.rdu2.redhat.com

2. Set SLA by syspurpose command:
1)
[root@dell-r730-001-guest22 ~]# rm -f /etc/rhsm/syspurpose/syspurpose.json

[root@dell-r730-001-guest22 ~]# syspurpose set-sla Premium
service_level_agreement set to Premium
System purpose successfully sent to subscription management server.

[root@dell-r730-001-guest22 ~]# syspurpose show
{}
System purpose successfully sent to subscription management server.

[root@dell-r730-001-guest22 ~]# cat /etc/rhsm/syspurpose/syspurpose.json 
{}

2)
[root@dell-r730-001-guest22 ~]# syspurpose set-role Workstation; syspurpose set-sla Premium; syspurpose set-usage QA
role set to Workstation
System purpose successfully sent to subscription management server.
service_level_agreement set to Premium
System purpose successfully sent to subscription management server.
usage set to QA
System purpose successfully sent to subscription management server.
 
[root@dell-r730-001-guest22 ~]# syspurpose show
{
  "usage": "QA",
  "role": "Workstation"
}
System purpose successfully sent to subscription management server.

[root@dell-r730-001-guest22 ~]# cat /etc/rhsm/syspurpose/syspurpose.json 
{
  "usage": "QA",
  "role": "Workstation"
}
[root@dell-r730-001-guest22 ~]# 


Actual results:
As step 2, after setting SLA by syspurpose, SLA is not stored in syspurpose.json, so 'syspurpose show' can not display SLA.

Expected results:
SLA should be shown by 'syspurpose show' after setting SLA by syspurpose

Additional info:

Comment 1 qianzhan 2018-12-20 07:43:31 UTC
subscription-manager command can not set SLA eigher:

1. Register RHEL-8.0-20181218.0 against Satellite6.5-snapshot8.0:
[root@dell-r730-001-guest22 ~]# subscription-manager  register
Registering to: ibm-hs22-04.rhts.eng.brq.redhat.com:443/rhsm
Username: admin                                                                           
Password: 
The system has been registered with ID: baae20ba-4a14-4713-a0ba-0796803f1750
The registered system name is: dell-r730-001-guest22.dsal.lab.eng.rdu2.redhat.com

2. Set SLA by subscription-manager:
[root@dell-r730-001-guest22 ~]# syspurpose show
{}
System purpose successfully sent to subscription management server.
[root@dell-r730-001-guest22 ~]# subscription-manager service-level --set Self-Support
service_level_agreement set to "Self-Support".
[root@dell-r730-001-guest22 ~]# syspurpose show
{}
System purpose successfully sent to subscription management server.
[root@dell-r730-001-guest22 ~]# subscription-manager service-level --show
Service level preference not set

3. Set SLA by subscription-manager when other system purpose attributes are not empty:
1) Set multiple system purpose attributes:

[root@dell-r730-001-guest22 ~]# syspurpose set-role Workstation; syspurpose set-usage QA
role set to Workstation
System purpose successfully sent to subscription management server.
usage set to QA
System purpose successfully sent to subscription management server.

[root@dell-r730-001-guest22 ~]# syspurpose show
{
  "role": "Workstation",
  "usage": "QA"
}
System purpose successfully sent to subscription management server.

2) Set SLA by subscription-manager:

[root@dell-r730-001-guest22 ~]# subscription-manager service-level --set Self-Support
Due to a conflicting change made at the server the service_level_agreement has not been set.
If you'd like to overwrite the server side change please run: subscription-manager service-level --set Self-Support

[root@dell-r730-001-guest22 ~]# subscription-manager service-level --set Self-Support
Due to a conflicting change made at the server the service_level_agreement has not been set.
If you'd like to overwrite the server side change please run: subscription-manager service-level --set Self-Support

[root@dell-r730-001-guest22 ~]# syspurpose show
{
  "role": "Workstation",
  "usage": "QA"
}
System purpose successfully sent to subscription management server.
[root@dell-r730-001-guest22 ~]# cat /etc/rhsm/syspurpose/syspurpose.json 
{
  "role": "Workstation",
  "usage": "QA"
}


As step 2 and step 3, subscription-manager command can not set SLA.

Comment 2 Craig Donnelly 2018-12-20 20:53:46 UTC
This is actually a dupe of BZ 1660224 -> It is unable to set any attribute that does not already exist inside the cache of syspurpose.
If the attribute is already inside the json file, then it can /update/ the contents of that attrbute, but if the attribute it not present, or unset - you will be unable to continue.

Comment 3 Kevin Howell 2019-01-14 15:27:16 UTC

*** This bug has been marked as a duplicate of bug 1660224 ***