Bug 463543

Summary: satellite.listEntitlements API - inconsistent behavior and generates error if run by Org Admin
Product: [Community] Spacewalk Reporter: Brad Buckingham <bbuckingham>
Component: APIAssignee: Brad Buckingham <bbuckingham>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 0.2CC: jesusr
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-01-22 16:30:00 UTC Type: ---
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: 456552    

Description Brad Buckingham 2008-09-23 20:58:24 UTC
Description of problem:

This API call seems to not be clear in its objectives and actual results when implementing multi-org.

With my satellite and cert at this time there are 208 free_slots. Querying the satellite.listEntitlements API with the "Satellite Administrator" or an "Organization Administrator" user for organization one shows this.

After creating a new organization and allocation 10 management slots to it, the free_slots decrements by 10 to report 198. While the arithmetic seems straight-forward enough, that is not consistent with the API documentation page: Lists all channel and system entitlements *on*the*satellite*.

When I use the "Organization Administrator" account for the second organization, I get this error:

xml declaration not at start of external entity at line 6, column 15, byte 470 at /us
r/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/XML/Parser.pm line 187

This error is reported in /var/log/tomcat5/catalina.out as a java.lang.NullPointerException: null

How reproducible:
always

Steps to Reproduce:

Actual results:

Expected results:
Given the documentation and actual results I'm not exactly sure what I would expect -- other than "not an error".

I would prefer that free_slots (and other information) is reportable on a per-organization basis.

Additional info:

Comment 1 Brad Buckingham 2008-09-23 21:04:40 UTC
Updated the satellite.listEntitlements API to properly handle the error scenario.  Also updated the API documentation to better reflect the expected behavior of the API.  E.g. "Lists all channel and system entitlements for the organization associated with the user executing the request."

The data returned by invoking this API should be consistent the Entitlement counts that would be provided to a user if they logged in to the web-ui and selected:
   Subscription Management -> System Entitlements
   Subscription Management -> Software Channel Entitlements

It should be noted that there are several additional API methods which provide different views of entitlements.  E.g.
   org.listSoftwareEntitlements(session)
   org.listSoftwareEntitlements(session, entitlement)
   org.listSoftwareEntitlementsForOrg(session, orgId)
   org.listSystemEntitlements(session)
   org.listSystemEntitlements(session, entitlement)
   org.listSystemEntitlements(session, orgId)

Comment 2 Brad Buckingham 2009-01-15 14:17:25 UTC
verified on spacewalk-java-0.4.14-1.el5