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 1658159

Summary: addon value is removed from syspurpose file when you try to add the same addon twice
Product: Red Hat Enterprise Linux 8 Reporter: Shwetha Kallesh <skallesh>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: khowell, redakkan, skallesh
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: 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: Environment:
Last Closed: 2020-12-11 11:14:09 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 Shwetha Kallesh 2018-12-11 12:17:05 UTC
Description of problem:

addon value is removed from syspurpose file when you try to add the same addon twice
Version-Release number of selected component (if applicable):

root@hp-dl380pgen8-02-vm-16 ~]# subscription-manager  version
server type: This system is currently not registered.
subscription management server: 2.6.0-1
subscription management rules: 5.30
subscription-manager: 1.23.8-6.el8


How reproducible:


Steps to Reproduce:

[root@hp-dl380pgen8-02-vm-16 ~]# cat /etc/rhsm/syspurpose/syspurpose.json 
{}[

Add an addon ELS on a unregistered system:
-----------------------------------------------------------------------------
root@hp-dl380pgen8-02-vm-16 ~]syspurpose add-addons ELS
Added ELS to addons.
Unable to send system purpose to subscription management server

Verify the value is added to syspurpose.json file
------------------------------------------------------------------------
[root@hp-dl380pgen8-02-vm-16 ~]# cat /etc/rhsm/syspurpose/syspurpose.json 
{
  "addons": [
    "ELS"
  ]
}

Add the add on again
----------------------------------------------------------------------------
[root@hp-dl380pgen8-02-vm-16 ~]#syspurpose add-addons ELS 
Not adding value ELS to addons; it already exists.
Unable to send system purpose to subscription management server

Observe the value is actually removed from syspurpose.json file
-----------------------------------------------------------------------
[root@hp-dl380pgen8-02-vm-16 ~]# cat /etc/rhsm/syspurpose/syspurpose.json 
{}

Actual results:
Value is removed from syspurpose.json file

Expected results:
Value shouldnot be removed

Additional info:

Comment 1 Kevin Howell 2019-01-07 15:47:45 UTC
Can you please retest against latest build?

Comment 2 Shwetha Kallesh 2019-01-09 08:54:44 UTC
Issue is fixed in the latest build:
[root@kvm-04-guest14 ~]# subscription-manager  version
server type: This system is currently not registered.
subscription management server: Unknown
subscription management rules: Unknown
subscription-manager: 1.23.8-12.el8


[root@kvm-04-guest14 ~]# cat /etc/rhsm/syspurpose/syspurpose.json 
{}[root@kvm-04-guest14 ~]# syspurpose add-addons ELS
Added ELS to addons.
Unable to send system purpose to subscription management server
[root@kvm-04-guest14 ~]#  cat /etc/rhsm/syspurpose/syspurpose.json 
{
  "addons": [
    "ELS"
  ]
}[root@kvm-04-guest14 ~]# syspurpose add-addons ELS 
Not adding value ELS to addons; it already exists.
Unable to send system purpose to subscription management server
[root@kvm-04-guest14 ~]# cat /etc/rhsm/syspurpose/syspurpose.json
{
  "addons": [
    "ELS"
  ]
}[root@kvm-04-guest14 ~]# syspurpose show
{
  "addons": [
    "ELS"
  ]
}
Unable to send system purpose to subscription management server

Comment 3 Rehana 2019-01-16 09:27:06 UTC
Verifying on :
===========

# subscription-manager version
subscription management server: 2.3.12-1
subscription management rules: 5.30
subscription-manager: 1.23.8-14.el8

On a unregistered system :
===========================

[root@kvm-02-guest09 ~]# syspurpose show
{}
Unable to send system purpose to subscription management server

# syspurpose add-addons ELS
Added ELS to addons.
Unable to send system purpose to subscription management server

# syspurpose show
{
  "addons": [
    "ELS"
  ]
}
Unable to send system purpose to subscription management server

# syspurpose add-addons ELS ; syspurpose show
Not adding value ELS to addons; it already exists.
Unable to send system purpose to subscription management server
{
  "addons": [
    "ELS"
  ]
}
Unable to send system purpose to subscription management server

^^ Notice the value was not removed when tried to add the same value again 

On a Registered system:
========================

# syspurpose show
{}
System purpose successfully sent to subscription management server.

# syspurpose add-addons EUS ; syspurpose show
Added EUS to addons.
System purpose successfully sent to subscription management server.
{
  "addons": [
    "EUS"
  ]
}
System purpose successfully sent to subscription management server.

# syspurpose add-addons EUS ; syspurpose show
Not adding value EUS to addons; it already exists.
System purpose successfully sent to subscription management server.
{
  "addons": [
    "EUS"
  ]
}
System purpose successfully sent to subscription management server.

^^ Notice the value was not removed when tried to add the same value again 

Also repeated the same steps for subscription-manager addon module as well, made the same observations there as well.

# subscription-manager addons --add "ELS" ; subscription-manager addons --add "ELS" ; syspurpose show
addons updated.
addons updated.
{
  "addons": [
    "ELS"
  ]
}
System purpose successfully sent to subscription management server.

Based on the above observations, moving the bug to Verified.

Comment 5 Rehana 2020-12-11 11:14:09 UTC
Old bug clean up :
================

Closing the bug with Current release ,the bug was verified by QE during a RHEL release cycle but was not closed.