Bug 489042 - Cannot give management entitlement to an org through API
Cannot give management entitlement to an org through API
Status: CLOSED CURRENTRELEASE
Product: Red Hat Satellite 5
Classification: Red Hat
Component: API (Show other bugs)
530
All Linux
low Severity medium
: ---
: ---
Assigned To: Brad Buckingham
Sayli Karmarkar
:
Depends On:
Blocks: 456996
  Show dependency treegraph
 
Reported: 2009-03-06 16:32 EST by Sayli Karmarkar
Modified: 2015-03-22 21:09 EDT (History)
2 users (show)

See Also:
Fixed In Version: sat530
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-10 15:54:55 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Sayli Karmarkar 2009-03-06 16:32:00 EST
Description of problem:
When I try:

server.org.setSystemEntitlements(key, 326, "provisioning_entitled", 1) 
it works but all - 
server.org.setSystemEntitlements(key, 326, "enterprise_entitled", 1)
server.org.setSystemEntitlements(key, 326, "sw_mgr_entitled", 1)
server.org.setSystemEntitlements(key, 326, "management_entitled", 1)

fail with "Invalid Entitlement".

 
On the similar note I guess we should mention what system entitlement labels are valid as arguments to the API.
Comment 1 Brad Buckingham 2009-03-06 17:55:29 EST
It looks like management_entitled is not a valid one for our case.  

The current supported entitlements appear to be:
  base: enterprise_entitled or sw_mgr_entitled
  add-on: monitoring_entitled, provisioning_entitled, virtualization_host, virtualization_host_platform

Currently, the API logic is only allowing the add-on entitlements and throws the exception mentioned for any changes to the base entitlements.  This should be updated.
Comment 2 Brad Buckingham 2009-03-06 18:06:05 EST
Correction.... sw_mgr_entitled is not valid in this case.

Supported values are:
  base: enterprise_entitled
  add-on: monitoring_entitled, provisioning_entitled, virtualization_host,
virtualization_host_platform
Comment 3 Brad Buckingham 2009-03-06 18:17:53 EST
git commit: 262ee714d147730cbbdf51c233fbf5408277128d

Updated API to support setting the management entitlements for the org.

Also, updated the API doc to list the supported entitlements.  E.g.

Method: setSystemEntitlements
Description:
Set an organization's entitlement allocation for the given software entitlement. If increasing the entitlement allocation, the default organization (i.e. orgId=1) must have a sufficient number of free entitlements.

Parameters:

    * string sessionKey
    * int orgId
    * string label - System entitlement label. Valid values include:
          o enterprise_entitled
          o monitoring_entitled
          o provisioning_entitled
          o virtualization_host
          o virtualization_host_platform
    * int allocation

Returns:

    * int - 1 on success, exception thrown otherwise.
Comment 4 Brad Buckingham 2009-03-17 17:17:48 EDT
mass move to ON_QA
Comment 5 Sayli Karmarkar 2009-03-19 15:12:39 EDT
verified.
Comment 6 John Sefler 2009-08-28 10:44:28 EDT
Verified on staged (Satellite-5.3.0-RHEL5-re20090811.0)

click Help|About > API > org > setSystemEntitlements


 Method: setSystemEntitlements
Description:
Set an organization's entitlement allocation for the given software entitlement. If increasing the entitlement allocation, the default organization (i.e. orgId=1) must have a sufficient number of free entitlements.

Parameters:

    * string sessionKey
    * int orgId
    * string label - System entitlement label. Valid values include:
          o enterprise_entitled
          o monitoring_entitled
          o provisioning_entitled
          o virtualization_host
          o virtualization_host_platform
    * int allocation

Returns:

    * int - 1 on success, exception thrown otherwise. 



[jsefler@jsefler api]$ cat org_setSystemEntitlements.py
#!/usr/bin/env python
import xmlrpclib

u = 'admin'
p = 'redhatqa'
url = 'http://sun-x4440-01.rhts.bos.redhat.com/rpc/api'
server = xmlrpclib.Server(url,verbose=0)
oid = 2

try:
 ses = server.auth.login(u,p)
 print "result=%d" % (server.org.setSystemEntitlements(ses,oid,"enterprise_entitled",5))
 print "result=%d" % (server.org.setSystemEntitlements(ses,oid,"monitoring_entitled",6))
 print "result=%d" % (server.org.setSystemEntitlements(ses,oid,"provisioning_entitled",7))
 print "result=%d" % (server.org.setSystemEntitlements(ses,oid,"virtualization_host",8))
 print "result=%d" % (server.org.setSystemEntitlements(ses,oid,"virtualization_host_platform",9))
 print "result=%d" % (server.org.setSystemEntitlements(ses,oid,"bad_entitlement",10))
except(xmlrpclib.Fault), f:
 print "ERROR: an Error was encountered!\n", f
 exit(-1)

[jsefler@jsefler api]$ ./org_setSystemEntitlements.py
result=1
result=1
result=1
result=1
result=1
ERROR: an Error was encountered!
<Fault -212: 'redstone.xmlrpc.XmlRpcFault: Invalid entitlement'>


Also verified that the api results were updated in the sat GUI:


moving to RELEASE_PENDING
Comment 7 Brandon Perkins 2009-09-10 15:54:55 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1434.html

Note You need to log in before you can comment on or make changes to this bug.