Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1708105

Summary: syspurpose unset operation is broken on RHEL 8.1
Product: Red Hat Enterprise Linux 8 Reporter: Rehana <redakkan>
Component: subscription-managerAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: medium Docs Contact:
Priority: high    
Version: 8.1CC: cdonnell, csnyder, jhnidek, jsefler, ktordeur, skallesh
Target Milestone: rcKeywords: Regression, Triaged
Target Release: 8.1Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1739699 (view as bug list) Environment:
Last Closed: 2019-11-05 22:15:36 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: 1708794, 1739699    

Description Rehana 2019-05-09 07:26:35 UTC
Description of problem:


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

# subscription-manager version

server type: This system is currently not registered.
subscription management server: 2.3.17-1
subscription management rules: 5.35
subscription-manager: 1.25.5-1.el8

How reproducible:

always
Steps to Reproduce:
[root@kvm-01-guest16 ~]# syspurpose unset sla
'name'
[root@kvm-01-guest16 ~]# syspurpose show
{
  "role": "Red Hat Enterprise Linux Compute Node",
  "service_level_agreement": "Standard",
  "usage": "Production"
}
[root@kvm-01-guest16 ~]# syspurpose unset role
'name'
[root@kvm-01-guest16 ~]# syspurpose show
{
  "role": "Red Hat Enterprise Linux Compute Node",
  "service_level_agreement": "Standard",
  "usage": "Production"
}

try the same using subscription-manage role module 

[root@kvm-01-guest16 ~]# subscription-manager role --unset
role unset.
[root@kvm-01-guest16 ~]# syspurpose show
{
  "service_level_agreement": "Standard",
  "usage": "Production"
}

Actual results:
syspurpose unset operation is broken

Expected results:
user should be successfully allowed to unset


Additional info:

2019-05-09 09:22:19,287 [DEBUG] syspurpose:19215:MainThread @cli.py:296 - Running the syspurpose utility...
2019-05-09 09:22:19,293 [DEBUG] syspurpose:19215:MainThread @identity.py:138 - Loading consumer info from identity certificates.
2019-05-09 09:22:19,293 [DEBUG] syspurpose:19215:MainThread @identity.py:149 - Reload of consumer identity cert /etc/pki/consumer/cert.pem raised an exception with msg: [Errno 2] No such file or directory: '/etc/pki/consumer/key.pem'
2019-05-09 09:22:19,294 [DEBUG] syspurpose:19215:MainThread @connection.py:924 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2019-05-09 09:22:19,294 [DEBUG] syspurpose:19215:MainThread @files.py:319 - Successfully read local syspurpose contents.
2019-05-09 09:22:19,294 [DEBUG] syspurpose:19215:MainThread @files.py:356 - Successfully read cached syspurpose contents.
2019-05-09 09:22:19,294 [DEBUG] syspurpose:19215:MainThread @files.py:462 - Unsetting value 'None' of key 'sla'.
2019-05-09 09:22:28,453 [DEBUG] syspurpose:19220:MainThread @cli.py:296 - Running the syspurpose utility...
2019-05-09 09:22:28,459 [DEBUG] syspurpose:19220:MainThread @identity.py:138 - Loading consumer info from identity certificates.
2019-05-09 09:22:28,459 [DEBUG] syspurpose:19220:MainThread @identity.py:149 - Reload of consumer identity cert /etc/pki/consumer/cert.pem raised an exception with msg: [Errno 2] No such file or directory: '/etc/pki/consumer/key.pem'
2019-05-09 09:22:28,460 [DEBUG] syspurpose:19220:MainThread @connection.py:924 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2019-05-09 09:22:28,460 [DEBUG] syspurpose:19220:MainThread @files.py:319 - Successfully read local syspurpose contents.
2019-05-09 09:22:28,461 [DEBUG] syspurpose:19220:MainThread @files.py:356 - Successfully read cached syspurpose contents.
2019-05-09 09:22:28,461 [DEBUG] syspurpose:19220:MainThread @files.py:273 - Attempting to sync syspurpose content...
2019-05-09 09:22:28,462 [DEBUG] syspurpose:19220:MainThread @connection.py:543 - Loaded CA certificates from /etc/rhsm/ca/: redhat-uep.pem
2019-05-09 09:22:28,462 [DEBUG] syspurpose:19220:MainThread @connection.py:591 - Making request: GET /subscription/status
2019-05-09 09:22:30,141 [DEBUG] syspurpose:19220:MainThread @connection.py:638 - Response: status=200, request="GET /subscription/status"
2019-05-09 09:22:30,142 [DEBUG] syspurpose:19220:MainThread @connection.py:977 - Server has the following capabilities: ['instance_multiplier', 'derived_product', 'vcpu', 'cert_v3', 'remove_by_pool_id', 'syspurpose', 'storage_band', 'cores', 'hypervisors_async', 'org_level_content_access', 'guest_limit', 'ram', 'batch_bind', 'combined_reporting']
2019-05-09 09:22:30,143 [DEBUG] syspurpose:19220:MainThread @files.py:334 - Failed to read remote syspurpose from server: no available connection, or the consumer is not registered.
2019-05-09 09:22:30,143 [DEBUG] syspurpose:19220:MainThread @files.py:552 - Attempting a three-way merge...
2019-05-09 09:22:30,143 [DEBUG] syspurpose:19220:MainThread @files.py:373 - Failed to update remote syspurpose on the server: no available connection, or the consumer is not registered.
2019-05-09 09:22:30,144 [DEBUG] syspurpose:19220:MainThread @files.py:506 - Successfully updated syspurpose values at '/etc/rhsm/syspurpose/syspurpose.json'.
2019-05-09 09:22:30,145 [DEBUG] syspurpose:19220:MainThread @files.py:506 - Successfully updated syspurpose values at '/var/lib/rhsm/cache/syspurpose.json'.
2019-05-09 09:22:30,145 [DEBUG] syspurpose:19220:MainThread @files.py:296 - Successfully synced system purpose.
2019-05-09 09:22:45,293 [DEBUG] syspurpose:19231:MainThread @cli.py:296 - Running the syspurpose utility...
2019-05-09 09:22:45,299 [DEBUG] syspurpose:19231:MainThread @identity.py:138 - Loading consumer info from identity certificates.
2019-05-09 09:22:45,299 [DEBUG] syspurpose:19231:MainThread @identity.py:149 - Reload of consumer identity cert /etc/pki/consumer/cert.pem raised an exception with msg: [Errno 2] No such file or directory: '/etc/pki/consumer/key.pem'
2019-05-09 09:22:45,300 [DEBUG] syspurpose:19231:MainThread @connection.py:924 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2019-05-09 09:22:45,301 [DEBUG] syspurpose:19231:MainThread @files.py:319 - Successfully read local syspurpose contents.
2019-05-09 09:22:45,301 [DEBUG] syspurpose:19231:MainThread @files.py:356 - Successfully read cached syspurpose contents.
2019-05-09 09:22:45,301 [DEBUG] syspurpose:19231:MainThread @files.py:462 - Unsetting value 'Red Hat Enterprise Linux Compute Node' of key 'role'.
2019-05-09 09:22:55,808 [DEBUG] syspurpose:19237:MainThread @cli.py:296 - Running the syspurpose utility...
2019-05-09 09:22:55,814 [DEBUG] syspurpose:19237:MainThread @identity.py:138 - Loading consumer info from identity certificates.
2019-05-09 09:22:55,814 [DEBUG] syspurpose:19237:MainThread @identity.py:149 - Reload of consumer identity cert /etc/pki/consumer/cert.pem raised an exception with msg: [Errno 2] No such file or directory: '/etc/pki/consumer/key.pem'
2019-05-09 09:22:55,815 [DEBUG] syspurpose:19237:MainThread @connection.py:924 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2019-05-09 09:22:55,815 [DEBUG] syspurpose:19237:MainThread @files.py:319 - Successfully read local syspurpose contents.
2019-05-09 09:22:55,815 [DEBUG] syspurpose:19237:MainThread @files.py:356 - Successfully read cached syspurpose contents.
2019-05-09 09:22:55,815 [DEBUG] syspurpose:19237:MainThread @files.py:273 - Attempting to sync syspurpose content...
2019-05-09 09:22:55,817 [DEBUG] syspurpose:19237:MainThread @connection.py:543 - Loaded CA certificates from /etc/rhsm/ca/: redhat-uep.pem
2019-05-09 09:22:55,817 [DEBUG] syspurpose:19237:MainThread @connection.py:591 - Making request: GET /subscription/status
2019-05-09 09:22:56,497 [DEBUG] syspurpose:19237:MainThread @connection.py:638 - Response: status=200, request="GET /subscription/status"
2019-05-09 09:22:56,498 [DEBUG] syspurpose:19237:MainThread @connection.py:977 - Server has the following capabilities: ['instance_multiplier', 'derived_product', 'vcpu', 'cert_v3', 'remove_by_pool_id', 'syspurpose', 'storage_band', 'cores', 'hypervisors_async', 'org_level_content_access', 'guest_limit', 'ram', 'batch_bind', 'combined_reporting']
2019-05-09 09:22:56,499 [DEBUG] syspurpose:19237:MainThread @files.py:334 - Failed to read remote syspurpose from server: no available connection, or the consumer is not registered.
2019-05-09 09:22:56,499 [DEBUG] syspurpose:19237:MainThread @files.py:552 - Attempting a three-way merge...
2019-05-09 09:22:56,499 [DEBUG] syspurpose:19237:MainThread @files.py:373 - Failed to update remote syspurpose on the server: no available connection, or the consumer is not registered.
2019-05-09 09:22:56,500 [DEBUG] syspurpose:19237:MainThread @files.py:506 - Successfully updated syspurpose values at '/etc/rhsm/syspurpose/syspurpose.json'.
2019-05-09 09:22:56,502 [DEBUG] syspurpose:19237:MainThread @files.py:506 - Successfully updated syspurpose values at '/var/lib/rhsm/cache/syspurpose.json'.
2019-05-09 09:22:56,502 [DEBUG] syspurpose:19237:MainThread @files.py:296 - Successfully synced system purpose.
^C

Comment 2 Rehana 2019-06-18 10:20:42 UTC
Reproducing the failure : 

subscription management server: 2.3.17-1
subscription management rules: 5.35
subscription-manager: 1.25.6-1.el8

[root@kvm-06-guest16 ~]# syspurpose set-role "RHEL Server"; syspurpose set-usage "Production"; syspurpose set-sla "Premium"
role set to "RHEL Server".
usage set to "Production".
service_level_agreement set to "Premium".

[root@kvm-06-guest16 ~]# syspurpose show
{
  "role": "RHEL Server",
  "service_level_agreement": "Premium",
  "usage": "Production"
}

[root@kvm-06-guest16 ~]# syspurpose unset role
'name'

Comment 3 Shwetha Kallesh 2019-06-20 11:41:36 UTC
Verification:
[root@kvm-01-guest17 ~]# subscription-manager version
subscription-manager: 1.25.11-1.el8

[root@kvm-01-guest17 ~]# syspurpose set-sla foo
service_level_agreement set to "foo".
[root@kvm-01-guest17 ~]# syspurpose set-role foorole
role set to "foorole".
[root@kvm-01-guest17 ~]# syspurpose set-usage foousage
usage set to "foousage".
[root@kvm-01-guest17 ~]# syspurpose show
{
  "role": "foorole",
  "service_level_agreement": "foo",
  "usage": "foousage"
}

[root@kvm-01-guest17 ~]# syspurpose add-addons adddd
Added adddd to addons.
addons updated.
[root@kvm-01-guest17 ~]# syspurpose show
{
  "addons": [
    "adddd"
  ],
  "role": "foorole",
  "service_level_agreement": "foo",
  "usage": "foousage"
}
[root@kvm-01-guest17 ~]# syspurpose unset-sla
service_level_agreement unset.
[root@kvm-01-guest17 ~]# syspurpose show
{
  "addons": [
    "adddd"
  ],
  "role": "foorole",
  "usage": "foousage"
}
[root@kvm-01-guest17 ~]# syspurpose unset-role
role unset.
[root@kvm-01-guest17 ~]# syspurpose unset-usage
usage unset.
[root@kvm-01-guest17 ~]# syspurpose show
{
  "addons": [
    "adddd"
  ]
}
[root@kvm-01-guest17 ~]# syspurpose unset-addons
addons unset.
[root@kvm-01-guest17 ~]# syspurpose show
{}

Comment 5 errata-xmlrpc 2019-11-05 22:15:36 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-2019:3561