Bug 1739697

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 7 Reporter: Chris Snyder <csnyder>
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: 7.8CC: candlepin-bugs, csnyder, jsefler, khowell, redakkan, rhsm-qe, skallesh
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.24.14-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1665022 Environment:
Last Closed: 2020-03-31 19:40:52 UTC Type: ---
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: 1665022    
Bug Blocks:    

Comment 3 Shwetha Kallesh 2019-09-11 07:38:36 UTC
[root@hpe-dl360gen8-01 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.7.5-1
subscription management rules: 5.37
subscription-manager: 1.24.17-1.el7


Verification using syspurpose usage command:

[root@hpe-dl360gen8-01 ~]# 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@hpe-dl360gen8-01 ~]# cat new_syspurpose 
{
"usage" : "Development"
}

[root@hpe-dl360gen8-01 ~]#  curl -ik -u username:password --request PUT "https://subscription.rhsm.stage.redhat.com:443/subscription/consumers/6ba35d3b-4c3e-4a46-9c0d-5e56a29baa3c" -d @./new_syspurpose --header "Content-Type: application/json"



[root@hpe-dl360gen8-01 ~]# syspurpose set-usage "foo"
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: syspurpose set usage foo

Verification using subscription-manager usage :

[root@hpe-dl360gen8-01 ~]# 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@hpe-dl360gen8-01 ~]#  curl -ik -u username:password --request PUT "https://subscription.rhsm.stage.redhat.com:443/subscription/consumers/6ba35d3b-4c3e-4a46-9c0d-5e56a29baa3c" -d @./new_syspurpose --header "Content-Type: application/json"


[root@hpe-dl360gen8-01 ~]# subscription-manager usage --set "foo 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

Comment 4 Shwetha Kallesh 2019-09-11 07:50:28 UTC
Adding verification steps for role and service-level too:

[root@hpe-dl360gen8-01 ~]# cat new_syspurpose 
{
"role" : "Development"
}

[root@hpe-dl360gen8-01 ~]#  curl -ik -u username:password --request PUT "https://subscription.rhsm.stage.redhat.com:443/subscription/consumers/6ba35d3b-4c3e-4a46-9c0d-5e56a29baa3c" -d @./new_syspurpose --header "Content-Type: application/json"

[root@hpe-dl360gen8-01 ~]# syspurpose set-role testrole
Due to a conflicting change made at the server the role has not been set.
If you'd like to overwrite the server side change please run: syspurpose set role testrole

[root@hpe-dl360gen8-01 ~]# 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@hpe-dl360gen8-01 ~]#  curl -ik -u username:password --request PUT "https://subscription.rhsm.stage.redhat.com:443/subscription/consumers/6ba35d3b-4c3e-4a46-9c0d-5e56a29baa3c" -d @./new_syspurpose --header "Content-Type: application/json"


[root@hpe-dl360gen8-01 ~]# subscription-manager role --set testrole
Due to a conflicting change made at the server the role has not been set.
If you'd like to overwrite the server side change please run: subscription-manager role --set testrole



[root@hpe-dl360gen8-01 ~]# 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@hpe-dl360gen8-01 ~]# vi new_syspurpose
[root@hpe-dl360gen8-01 ~]# cat new_syspurpose 
{
"serviceLevel" : "Development"
}
[root@hpe-dl360gen8-01 ~]#  curl -ik -u username:password --request PUT "https://subscription.rhsm.stage.redhat.com:443/subscription/consumers/6ba35d3b-4c3e-4a46-9c0d-5e56a29baa3c" -d @./new_syspurpose --header "Content-Type: application/json"

[root@hpe-dl360gen8-01 ~]# syspurpose set-sla foo
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: syspurpose set service_level_agreement foo


[root@hpe-dl360gen8-01 ~]# 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@hpe-dl360gen8-01 ~]#  curl -ik -u username:password --request PUT "https://subscription.rhsm.stage.redhat.com:443/subscription/consumers/6ba35d3b-4c3e-4a46-9c0d-5e56a29baa3c" -d @./new_syspurpose --header "Content-Type: application/json"
HTTP/1.1 204 No Content
Server: Apache-Coyote/1.1
x-candlepin-request-uuid: c0a10059-35d7-45ad-a241-0d4f8a41754a
X-Version: 2.7.5-1
Date: Wed, 11 Sep 2019 07:49:34 GMT

[root@hpe-dl360gen8-01 ~]# subscription-manager service-level --set fpp
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 fpp

Comment 6 errata-xmlrpc 2020-03-31 19:40:52 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, 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:1028