Bug 1424614

Summary: [RFE] Enhance the 'rct cat-manifest' command to show manifests with the Organization/Environment Content Access Flag
Product: Red Hat Enterprise Linux 7 Reporter: Rich Jerrido <rjerrido>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: low Docs Contact:
Priority: high    
Version: 7.4CC: khowell, redakkan, rjerrido, skallesh, wpoteat
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.19.6-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 19:20:42 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 Rich Jerrido 2017-02-17 20:09:17 UTC
Description of problem:


As a user of Red Hat's subscription-tooling, I may have manifests that have the 'Organization/Environment Content Access' flag set. 

As a user of rct, I'd like to introspect my manifest to see this flag when it exists and its status. Thus, I'd like to see the 'cat-manifest' subcommand updated to show this 

Version-Release number of selected component (if applicable):
ubscription-manager-1.19.1-1


Additional info:

Comment 2 Rich Jerrido 2017-03-27 23:08:19 UTC
Proposed patch here - https://github.com/candlepin/subscription-manager/pull/1567

Comment 4 Shwetha Kallesh 2017-05-12 13:35:20 UTC
Failed_qa , I see Content Access Mode as "entitlement" instead of "org_environment"

[root@bkr-hv01-guest06 ~]# subscription-manager  version
server type: Red Hat Subscription Management
subscription management server: 2.1.0-1
subscription management rules: 5.23
subscription-manager: 1.19.12-1.el7
python-rhsm: 1.19.6-1.el7


[root@bkr-hv01-guest06 ~]# curl -X PUT -k -u admin:admin   -d '{"contentAccessMode":"org_environment"}'  -H "Content-Type: application/json"  "https://Shwetha-candlepin.usersys.redhat.com:8443/candlepin/owners/snowwhite" | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   437    0   398  100    39    275     26  0:00:01  0:00:01 --:--:--   275
{
    "autobindDisabled": null,
    "contentAccessMode": "org_environment",
    "contentAccessModeList": "org_environment",
    "contentPrefix": null,
    "created": "2017-05-11T14:41:27+0000",
    "defaultServiceLevel": null,
    "displayName": "Snow White",
    "href": "/owners/snowwhite",
    "id": "8ac6a3185bf7f180015bf7f51b8c0004",
    "key": "snowwhite",
    "logLevel": null,
    "parentOwner": null,
    "updated": "2017-05-12T06:57:51+0000",
    "upstreamConsumer": null
}

[root@bkr-hv01-guest06 ~]# subscription-manager  register --type candlepin
Registering to: Shwetha-candlepin.usersys.redhat.com:8443/candlepin
Username: admin
Password: 
Organization: snowwhite
The system has been registered with ID: 1cbfd163-d3c0-4cf4-9f54-0b8ff3d29a9d 

[root@bkr-hv01-guest06 ~]# curl -k -u admin:admin --request GET https://Shwetha-candlepin.usersys.redhat.com:8443/candlepin/consumers/1cbfd163-d3c0-4cf4-9f54-0b8ff3d29a9d/export >> export.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 45580    0 45580    0     0  17378      0 --:--:--  0:00:02 --:--:-- 17377


[root@bkr-hv01-guest06 ~]# rct cat-manifest export.zip 

+-------------------------------------------+
	Manifest
+-------------------------------------------+

General:
	Server: 
	Server Version: 2.1.0-1
	Date Created: 2017-05-12T13:06:06.265+0000
	Creator: admin

Consumer:
	Name: bkr-hv01-guest06.dsal.lab.eng.bos.redhat.com
	UUID: 1cbfd163-d3c0-4cf4-9f54-0b8ff3d29a9d
	Content Access Mode: entitlement
	Type: candlepin

Subscriptions:
	None

Comment 5 Kevin Howell 2017-06-07 21:47:29 UTC
Will, I reproduced using the above steps, but I'm not 100% sure the above steps reflect intended usage. i.e. does creating a consumer of type candlepin from subscription-manager reflect how the portal would actually create the consumer? It seems to me it's not incorrect that the mode is entitlement since the contentAccessMode on the consumer object is still empty?

Comment 6 William Poteat 2017-06-08 14:16:47 UTC
The contentAccessMode does not flow down to the manifest consumer. It is set explicitly on the consumer by must be an allowed mode in the onwer's contentAccessModeList.

Also, we recently realized that allowing manifest consumer creation from the SubMan command line is a bad idea. What you end up with on the client is an incorrect representation of a place-holder at the server. It is neither a working client nor a distributor. It will be blocked in Candlepin as soon as this is deployed: https://github.com/candlepin/candlepin/pull/1593

Comment 7 Kevin Howell 2017-06-13 20:46:51 UTC
Shwetha, with comment 6 in mind, can you please work with wpoteat to find a better way to test this, and then let us know if it still fails QA?

Comment 9 Kevin Howell 2017-06-22 21:58:02 UTC
Shwetha, can you please verify what happens when you create a manifest consumer with contentAccessMode set to "org_entitlement"?

Comment 12 Rehana 2017-06-23 13:55:30 UTC
Retesting with : 
subscription-manager-gui-1.19.20-1.el7.x86_64
subscription-manager-1.19.20-1.el7.x86_64
subscription-manager-initial-setup-addon-1.19.20-1.el7.x86_64

To verify :

Create customer of type Candlepin : 

# curl -H "Content-Type: application/json" -u admin:admin -X POST -k 'https://server:8443/candlepin/consumers?user=admin&owner=snowwhite' -d '{"type":{"label":"candlepin"},"name":"foobar"}' 
{
  "id" : "8ac6a3625ccedd85015cd4f490410c1c",
  "uuid" : "8747ab00-adc9-4b00-af56-947906849405",
  "name" : "foobar",
  "username" : "admin",
  "entitlementStatus" : null,
  "serviceLevel" : "",
  "releaseVer" : {
    "releaseVer" : null
<snip>

Now update consumer with contentAccessmode using the UUID from Above curl reasponse

# curl -H "Content-Type: application/json" -u admin:admin -X PUT -k 'https://sever:8443/candlepin/consumers/8747ab00-adc9-4b00-af56-947906849405' -d '{"contentAccessMode":"org_environment"}' 

Export the manifest:

# curl -H "Content-Type: application/json" -u admin:admin -k 'https://server:8443/candlepin/consumers/8747ab00-adc9-4b00-af56-947906849405/export' > /tmp/test.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 45395    0 45395    0     0   116k      0 --:--:-- --:--:-- --:--:--  116k


root@dhcp35-134 ~]# rct cat-manifest /tmp/test.zip 

+-------------------------------------------+
	Manifest
+-------------------------------------------+

General:
	Server: 
	Server Version: 2.1.1-1
	Date Created: 2017-06-23T12:39:03.993+0000
	Creator: admin

Consumer:
	Name: foobar
	UUID: 8747ab00-adc9-4b00-af56-947906849405
	Content Access Mode: org_environment --> Is now updated correctly.
	Type: candlepin

Subscriptions:
	None

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

Comment 13 errata-xmlrpc 2017-08-01 19:20:42 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-2017:2083