Bug 1656802

Summary: subscription-manager: I cannot unset role even I follow the sudgestion to run the command twicely
Product: Red Hat Enterprise Linux 8 Reporter: Jan Stavel <jstavel>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: high Docs Contact:
Priority: high    
Version: 8.0CC: cdonnell, csnyder, jstavel, khowell, redakkan, skallesh
Target Milestone: rcKeywords: Triaged
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-06-14 02:06:33 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: 1660224    
Bug Blocks:    

Description Jan Stavel 2018-12-06 11:18:25 UTC
Description of problem:

I cannot unset a role property.
The application asks me to repeat the command.
Once I repeat it the application asks me to do so again.


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

root@ibm-p9z-15-lp9 ~]# subscription-manager config | grep rhsm
   hostname = subscription.rhsm.stage.redhat.com
[rhsm]
   ca_cert_dir = [/etc/rhsm/ca/]
   pluginconfdir = [/etc/rhsm/pluginconf.d]
   plugindir = [/usr/share/rhsm-plugins]
   repo_ca_cert = /etc/rhsm/ca/redhat-uep.pem


[root@ibm-p9z-15-lp9 ~]# rpm -qa | egrep "subscription|rhsm|cockpit"
dnf-plugin-subscription-manager-1.23.8-4.el8.ppc64le
subscription-manager-1.23.8-4.el8.ppc64le
subscription-manager-rhsm-certificates-1.23.8-4.el8.ppc64le
librhsm-0.0.3-2.el8.ppc64le
python3-subscription-manager-rhsm-1.23.8-4.el8.ppc64le


How reproducible:


   [root@ibm-p9z-15-lp9 ~]# subscription-manager role 
   
   You are attempting to use a locale that is not installed.
   Current Role: RHEL Server

   [root@ibm-p9z-15-lp9 ~]# subscription-manager role --unset
   
   You are attempting to use a locale that is not installed.
   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 --unset

   [root@ibm-p9z-15-lp9 ~]# subscription-manager role --unset
   
   You are attempting to use a locale that is not installed.
   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 --unset


Actual results:

The application tells me to repeat the previous command - again and again.

Expected results:

Once I repeat the command a role should be cleaned.

Additional info:

Comment 1 Jan Stavel 2018-12-10 10:36:38 UTC
I am trying to simulate this issue.
I'll let you all know once I simulate this issue.

Comment 3 Craig Donnelly 2018-12-11 16:48:07 UTC
Tested this against subscription-manager-1.23.8-6.el8:

[root@unused ~]# subscription-manager config | grep hostname
   hostname = subscription.rhsm.stage.redhat.com
[root@unused ~]# reg
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
The system has been registered with ID: 0dba7f6d-3567-49fe-bca7-f905817e9180
The registered system name is: unused
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64 High Touch Beta
Status:       Subscribed

[root@unused ~]# subscription-manager role --set "RHEL Server"
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 RHEL Server
[root@unused ~]# subscription-manager role --set "RHEL Server"
role set to "RHEL Server".

[root@unused ~]# syspurpose show
{
  "service_level_agreement": "",
  "usage": "",
  "role": "RHEL Server",
  "addons": []
}
System purpose successfully sent to subscription management server.
[root@unused ~]# ./ident.sh 
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
x-candlepin-request-uuid: 2b61cb5a-c0dc-40dd-abe6-d42640a4cab3
X-Version: 2.3.11-1
Content-Type: application/json
Transfer-Encoding: chunked
Date: Tue, 11 Dec 2018 16:47:37 GMT

{"serviceLevel":"","role":"RHEL Server","usage":"","addOns":[]}[root@unused ~]# 
[root@unused ~]# subscription-manager role --unset
role unset.

==================

Can be unset successfully now.

Comment 4 Jan Stavel 2018-12-11 16:49:21 UTC
Thanks Crag for the help.

Comment 5 Jan Stavel 2018-12-11 16:50:14 UTC
I have already automated this scenario.

Comment 7 Craig Donnelly 2018-12-17 21:08:17 UTC
QA of this is BLOCKED on BZ 1660224

Comment 8 Shwetha Kallesh 2019-01-07 06:19:48 UTC
Verification:
[root@kvm-02-guest13 ~]# 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


[root@kvm-02-guest13 ~]# subscription-manager role --set "RHEL Server"

role set to "RHEL Server".
[root@kvm-02-guest13 ~]# 
[root@kvm-02-guest13 ~]# subscription-manager role 
Current Role: RHEL Server
[root@kvm-02-guest13 ~]# syspurpose show
{
  "role": "RHEL Server",
  "service_level_agreement": "Premium"
}
System purpose successfully sent to subscription management server.
[root@kvm-02-guest13 ~]# subscription-manager role --unset
role unset.
[root@kvm-02-guest13 ~]# syspurpose show
{
  "service_level_agreement": "Premium"
}
System purpose successfully sent to subscription management server.
[root@kvm-02-guest13 ~]# subscription-manager role 
Role not set.

[root@kvm-02-guest13 ~]# subscription-manager service-level --unset 
service_level_agreement unset.
[root@kvm-02-guest13 ~]# syspurpose show
{}
System purpose successfully sent to subscription management server.

[root@kvm-02-guest13 ~]# subscription-manager usage --set "QA"
usage set to "QA".
[root@kvm-02-guest13 ~]# syspurpose show
{
  "usage": "QA"
}
System purpose successfully sent to subscription management server.
[root@kvm-02-guest13 ~]# subscription-manager usage --unset
usage unset.
[root@kvm-02-guest13 ~]# syspurpose show
{}
System purpose successfully sent to subscription management server.