Bug 1665022

Summary: Syspurpose commands should display the same message as subscription-manager when there is conflict in system purpose values between server and client
Product: Red Hat Enterprise Linux 8 Reporter: Rehana <redakkan>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: medium Docs Contact:
Priority: high    
Version: 8.0CC: csnyder, jsefler, khowell, wpoteat
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.25.6-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1739697 (view as bug list) Environment:
Last Closed: 2020-11-04 01:38:37 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: 1739697    

Description Rehana 2019-01-10 09:58:46 UTC
Description of problem:
Syspurpose commands should displays the same message as subscription-manager when there is conflict in syspurpose values between server and client 

Version-Release number of selected component (if applicable):
# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.3.12-1
subscription management rules: 5.30
subscription-manager: 1.23.8-12.el8

How reproducible:
Always 

Steps to Reproduce:
1.Register system to server
2.Set systempurpose value on the system
# syspurpose set-role "RHEL Server"; syspurpose set-sla "Premium"; syspurpose set-usage "Production"; syspurpose show
role set to RHEL Server
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 Production
System purpose successfully sent to subscription management server.
{
  "role": "RHEL Server",
  "service_level_agreement": "Premium",
  "usage": "Production"
}
System purpose successfully sent to subscription management server.

3. 
# cat new_syspurpose 
{
"usage" : "Development"
}

4. Modify the usage values from server 
 curl -ik -u username:password --request PUT "https://subscription.rhsm.stage.redhat.com:443/subscription/consumers/a57325d5-2e12-4c3c-970d-d5819d74bb02" -d @./new_syspurpose --header "Content-Type: application/json"

5.Now try to set value for usage with systempurpose tool

# syspurpose set-usage "foo"
usage set to foo
System purpose successfully sent to subscription management server.


Actual results:
Observed that no conflicting message appeared , the data was successfully set 

Expected results:
Message "Due to a conflicting change made at the server the usage has not been set.
If you'd like to overwrite the server side change please run: subscription-manager usage --set Disaster Recovery" should be displayed 

Additional info:
Message displayed when try to set the usage value using subscription-manager command 

# subscription-manager usage --set "Disaster Recovery"
Due to a conflicting change made at the server the usage has not been set.
If you'd like to overwrite the server side change please run: subscription-manager usage --set Disaster Recovery
[root@kvm-01-guest29 ~]# subscription-manager usage --set "Disaster Recovery"
usage set to "Disaster Recovery".

Comment 3 Chris Snyder 2019-05-28 15:53:11 UTC
This is in the latest build for RHEL 8.1. Moving to MODIFIED.

Comment 6 Rehana 2020-07-21 11:24:53 UTC
Verifying on : 
=============

# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.1.16-1
subscription management rules: 5.40
subscription-manager: 1.27.10-1.el8

[root@kvm-07-guest26 ~]# rpm -qa subscr* --changelog | grep 1665022
- 1665022: Syspurpose client to have the same behavior as SubMan when in

[root@kvm-07-guest26 ~]# subscription-manager register --serverurl=https://subscription.rhsm.stage.redhat.com:443/subscription
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: username
Password: 
The system has been registered with ID: 1f5900f8-c578-43c1-a7cd-957497ccb418
The registered system name is: kvm-07-guest26.hv2.lab.eng.bos.redhat.com

[root@kvm-07-guest26 ~]# syspurpose set-role "RHEL Server"; syspurpose set-sla "Premium"; syspurpose set-usage "Production"; syspurpose show
role set to "RHEL Server".
service_level_agreement set to "Premium".
usage set to "Production".
{
  "role": "RHEL Server",
  "service_level_agreement": "Premium",
  "usage": "Production"
}
[root@kvm-07-guest26 ~]# vi new_syspurpose
[root@kvm-07-guest26 ~]# curl -ik -u rhel8_rhsm_testing_1:redhat --request PUT "https://subscription.rhsm.stage.redhat.com:443/subscription/consumers/1f5900f8-c578-43c1-a7cd-957497ccb418" -d @./new_syspurpose --header "Content-Type: application/json"
HTTP/1.1 204 No Content
Server: openresty/1.17.8.1
Date: Tue, 21 Jul 2020 11:22:29 GMT
Connection: keep-alive
x-candlepin-request-uuid: e21d5bef-88cf-4205-9e40-a43a6caff6ec
X-Version: 3.1.16-1

UPDATE value at server side 

[root@kvm-07-guest26 ~]# syspurpose set-usage "foo"
Warning: A usage of "Development" was recently set for this system by the entitlement server administrator.
If you'd like to overwrite the server side change please run: syspurpose set usage "foo"

^^ notice a warning message is appearing now . 

Based on the above observation moving the bug to verified.

Comment 9 errata-xmlrpc 2020-11-04 01:38:37 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