Bug 1763271

Summary: Do not list installed products with "Not Subscribed" status when the registration is to an org with contentAccessMode:org_environment
Product: Red Hat Enterprise Linux 7 Reporter: Shwetha Kallesh <skallesh>
Component: subscription-managerAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: low Docs Contact:
Priority: high    
Version: 7.8CC: csnyder, jhnidek, jsefler, ktordeur, redakkan, rjerrido, wpoteat
Target Milestone: rcKeywords: Triaged
Target Release: ---   
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-09-29 19:22:47 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 2019-10-18 15:51:15 UTC
Description of problem:
 Do not list installed products with "Not Subscribed" status when the registration is to an org with contentAccessMode=org_environment

Version-Release number of selected component (if applicable):
[root@kvm-01-guest05 product]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.8.0-1
subscription management rules: 5.37
subscription-manager: 1.24.21-1.el7

How reproducible:


Steps to Reproduce:
[root@kvm-03-guest01 ~]# curl --stderr /dev/null --insecure --user admin:admin --request PUT --data '{"contentAccessMode":"org_environment"}' --header 'accept: application/json' --header 'content-type: application/json' https://shwetha-workstation.usersys.redhat.com:8443/candlepin/owners/snowwhite
{
  "created" : "2019-10-15T09:48:19+0000",
  "updated" : "2019-10-18T09:01:02+0000",
  "id" : "8ac6a3a96dced151016dced17ec10003",
  "key" : "snowwhite",
  "displayName" : "Snow White",
  "parentOwner" : null,
  "contentPrefix" : null,
  "defaultServiceLevel" : null,
  "upstreamConsumer" : null,
  "logLevel" : null,
  "autobindDisabled" : false,
  "contentAccessMode" : "org_environment",
  "contentAccessModeList" : "entitlement,org_environment",
  "lastRefreshed" : "2019-10-15T09:49:40+0000",
  "href" : "/owners/snowwhite"
}


[root@kvm-01-guest05 product]# subscription-manager register --org snowwhite --username admin --password admin --force --auto-attach
Unregistering from: shwetha-workstation.usersys.redhat.com:8443/candlepin
The system with UUID 22cc084b-4ba5-4b4c-8bce-938d973b531e has been unregistered
All local data removed
Registering to: shwetha-workstation.usersys.redhat.com:8443/candlepin
The system has been registered with ID: 314b3967-d2d5-40c3-b2bb-5a0890390057
The registered system name is: kvm-01-guest05.lab.eng.rdu2.redhat.com
Ignoring request to auto-attach. It is disabled for org "snowwhite".
Installed Product Current Status:
Product Name: Awesome OS Server Bits
Status:       Not Subscribed
^^ since auto-attach is disabled and user has access to content , this info "Status:       Not Subscribed" is creating confusion

[root@kvm-03-guest01 ~]# curl -k --request POST --user admin:admin --data '{"name":"GoldenTicketAutoFalse","autoAttach":"false"}' --header 'accept: application/json' --header 'content-type: application/json' https://shwetha-workstation.uersys.redhat.com:8443/candlepin/owners/snowwhite/activation_keys | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   617    0   564  100    53    438     41  0:00:01  0:00:01 --:--:--   437
{
    "addOns": [],
    "autoAttach": false,
    "contentOverrides": [],
    "created": "2019-10-18T09:03:10+0000",
    "description": null,
    "id": "8ac6a3a96dced151016dde1b400b0d4c",
    "name": "GoldenTicketAutoFalse",
    "owner": {
        "displayName": "Snow White",
        "href": "/owners/snowwhite",
        "id": "8ac6a3a96dced151016dced17ec10003",
        "key": "snowwhite"
    },
    "pools": [],
    "products": [],
    "releaseVer": {
        "releaseVer": null
    },
    "role": null,
    "serviceLevel": null,
    "updated": "2019-10-18T09:03:10+0000",
    "usage": null
}


[root@kvm-03-guest01 ~]# subscription-manager register --activationkey GoldenTicketAutoFalse --org snowwhite --force
Unregistering from: shwetha-workstation.usersys.redhat.com:8443/candlepin
The system with UUID e03256f6-bb22-4a65-afca-72923624ab76 has been unregistered
All local data removed
The system has been registered with ID: c34ebf3e-ba26-41bc-8c21-e95589d7cd8d
The registered system name is: kvm-03-guest01.hv2.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Awesome OS Instance Server Bits
Status:       Not Subscribed



Actual results:


Expected results:
either remove the status or do not display installed product list completely when registering to org with contentAccessMode=org_environment

Additional info:

Comment 8 Shwetha Kallesh 2020-04-16 12:29:57 UTC
[root@hpe-dl380pgen8-02-vm-15 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.1.9-1
subscription management rules: 5.39
subscription-manager: 1.24.32


[root@hpe-dl380pgen8-02-vm-15 ~]# curl --stderr /dev/null --insecure --user admin:admin --request PUT --data '{"contentAccessMode":"org_environment"}' --header 'accept: application/json' --header 'content-type: application/json' https://10.70.35.0:8443/candlepin/owners/snowwhite
{
  "created" : "2020-04-16T10:29:37+0000",
  "updated" : "2020-04-16T11:50:48+0000",
  "id" : "8ac6a38071828911017182896e8d0002",
  "key" : "snowwhite",
  "displayName" : "Snow White",
  "parentOwner" : null,
  "contentPrefix" : null,
  "defaultServiceLevel" : null,
  "upstreamConsumer" : null,
  "logLevel" : null,
  "autobindDisabled" : false,
  "autobindHypervisorDisabled" : false,
  "contentAccessMode" : "org_environment",
  "contentAccessModeList" : "entitlement,org_environment",
  "lastRefreshed" : "2020-04-16T10:34:17+0000",
  "href" : "/owners/snowwhite"
}


[root@hpe-dl380pgen8-02-vm-15 ~]# subscription-manager register --org snowwhite --username admin --password admin --force --auto-attach --serverurl ansible-candlepin.usersys.redhat.com:8443/candlepin
Registering to: ansible-candlepin.usersys.redhat.com:8443/candlepin
The system has been registered with ID: 28a134b6-d46e-4217-8bfd-02498e31f386
The registered system name is: hpe-dl380pgen8-02-vm-15.hpe2.lab.eng.bos.redhat.com
Ignoring request to auto-attach. It is disabled for org "snowwhite" because of the content access mode setting.
^^ observe that installed product list is not getting displayed

Activation key with auto-attach=false

[root@hpe-dl380pgen8-02-vm-15 ~]# curl -k --request POST --user admin:admin --data '{"name":"GoldenTicketAutoFalse","autoAttach":"false"}' --header 'accept: application/json' --header 'content-type: application/json' https://ansible-candlepin.usersys.redhat.com:8443/candlepin/owners/snowwhite/activation_keys | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   617    0   564  100    53    147     13  0:00:04  0:00:03  0:00:01   147
{
    "addOns": [],
    "autoAttach": false,
    "contentOverrides": [],
    "created": "2020-04-16T12:19:23+0000",
    "description": null,
    "id": "8ac6a38071828911017182ededbb0d71",
    "name": "GoldenTicketAutoFalse",
    "owner": {
        "displayName": "Snow White",
        "href": "/owners/snowwhite",
        "id": "8ac6a38071828911017182896e8d0002",
        "key": "snowwhite"
    },
    "pools": [],
    "products": [],
    "releaseVer": {
        "releaseVer": null
    },
    "role": null,
    "serviceLevel": null,
    "updated": "2020-04-16T12:19:23+0000",
    "usage": null
}
[root@hpe-dl380pgen8-02-vm-15 ~]# subscription-manager register --activationkey GoldenTicketAutoFalse --org snowwhite --force
Unregistering from: ansible-candlepin.usersys.redhat.com:8443/candlepin
The system with UUID 28a134b6-d46e-4217-8bfd-02498e31f386 has been unregistered
All local data removed
The system has been registered with ID: d4761b1c-39f6-4dcc-bd8d-3b8b34f47fa7
The registered system name is: hpe-dl380pgen8-02-vm-15.hpe2.lab.eng.bos.redhat.com
^^ no installed products are listed

Activationkey with auto-attach=true

[root@hpe-dl380pgen8-02-vm-15 ~]# curl -k --request POST --user admin:admin --data '{"name":"GoldenTicketAutoTrue","autoAttach":"true"}' --header 'accept: application/json' --header 'content-type: application/json' https://ansible-candlepin.usersys.redhat.com:8443/candlepin/owners/snowwhite/activation_keys | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   613    0   562  100    51    248     22  0:00:02  0:00:02 --:--:--   248
{
    "addOns": [],
    "autoAttach": true,
    "contentOverrides": [],
    "created": "2020-04-16T12:21:23+0000",
    "description": null,
    "id": "8ac6a38071828911017182efc3630d85",
    "name": "GoldenTicketAutoTrue",
    "owner": {
        "displayName": "Snow White",
        "href": "/owners/snowwhite",
        "id": "8ac6a38071828911017182896e8d0002",
        "key": "snowwhite"
    },
    "pools": [],
    "products": [],
    "releaseVer": {
        "releaseVer": null
    },
    "role": null,
    "serviceLevel": null,
    "updated": "2020-04-16T12:21:23+0000",
    "usage": null
}
[root@hpe-dl380pgen8-02-vm-15 ~]# subscription-manager register --activationkey GoldenTicketAutoTrue --org snowwhite --force
Unregistering from: ansible-candlepin.usersys.redhat.com:8443/candlepin
The system with UUID d4761b1c-39f6-4dcc-bd8d-3b8b34f47fa7 has been unregistered
All local data removed
The system has been registered with ID: 838e4244-12eb-4bdd-ade3-2a4b2f97f642
The registered system name is: hpe-dl380pgen8-02-vm-15.hpe2.lab.eng.bos.redhat.com
^^ no installed product list , however there is no "Ignoring request to auto-attach. It is disabled for org "snowwhite" because of the content access mode setting." message , but a bug(https://bugzilla.redhat.com/show_bug.cgi?id=1805111) for that has already been logged, so moving this bug to verified

[root@hpe-dl380pgen8-02-vm-15 ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Disabled
Content Access Mode is set to Organization/Environment Access. This host has access to content, regardless of subscription status.

System Purpose Status: Disabled

Comment 10 errata-xmlrpc 2020-09-29 19:22:47 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 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:3866