Bug 667232

Summary: Conversion to/from flex guests during activation does not work correctly
Product: Red Hat Satellite 5 Reporter: Justin Sherrill <jsherril>
Component: OtherAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Martin Minar <mminar>
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: cperry, fnadge, mkoci, mminar, mzazrivec
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Satellite certificate activation logic involving conversion of regular entitlements to flex entitlements did not restrict the conversion to a channel family and was converting all system's subscriptions. Consequence: Satellite certificate activation would fail when converting regular system entitlements to flex entitlements for both the base and the child channels of the converted system. Fix: Satellite certificate activation logic was fixed to properly convert regular to flex entitlements in the critical cases. Result: Activation of a new Satellite certificate will correctly convert regular entitlements to flex entitlements for base and child channels of a system.
Story Points: ---
Clone Of:
: 668002 (view as bug list) Environment:
Last Closed: 2011-01-17 21:19:59 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: 646488, 668002    

Description Justin Sherrill 2011-01-04 21:11:59 UTC
Description of problem:

If activating a cert that would require systems to be converted from regular entitlements to flex entitlements, things will go badly if this will need to be done for both a channel family of a base channel and a channel family of a child channel of the same system. 

I.e.  if System A is subscribed to rhel-server and rhn-tools, and both of these would need to be converted to flex in order for activation to succeed, then things will go wrong.  


Technical details:  when the rhn_entitlement.activate_channel_family procedure needs to convert a system's subscription to flex, it does not restrict the conversion to a channel family, but instead does it for all the system's subscriptions.  So this seems to work correctly for the first channel family that is activated, but the second channel family does not work properly because it has already been converted and thus is not eligible to be and activation blows up.


More concrete details with reproducer information to follow in next comment.

Comment 2 Justin Sherrill 2011-01-04 22:09:46 UTC
Reproducer Steps:

1.  activate attached  5-0.cert
2.  register 5 guests (without their hosts).  Only these 5 guests should be registered to the satellite
3.  Ensure they are subscribed to a rhel-server channel
4.  Subscribe them to an rhn-tools channel 
5.  attempt to activate the attached 1-4.cert

results:


ERROR: unhandled exception occurred:
Traceback (most recent call last):
  File "/usr/bin/rhn-satellite-activate", line 45, in ?
    sys.exit(abs(mod.main() or 0))
  File "/usr/share/rhn/satellite_tools/rhn_satellite_activate.py", line 646, in main
    localUpdateChannels()
  File "/usr/share/rhn/satellite_tools/rhn_satellite_activate.py", line 238, in localUpdateChannels
    sync_handlers.populate_channel_family_permissions(sat_cert)
  File "/usr/share/rhn/satellite_tools/sync_handlers.py", line 704, in populate_channel_family_permissions
    importer.run()
  File "/usr/share/rhn/server/importlib/importLib.py", line 651, in run
    self.submit()
  File "/usr/share/rhn/server/importlib/channelImport.py", line 291, in submit
    self.backend.processChannelFamilyPermissions(self.batch)
  File "/usr/share/rhn/server/importlib/backend.py", line 1098, in processChannelFamilyPermissions
    (cfp['org_id'], cfp['channel_family'], cfp['max_members']), explain=0)
common.rhnException.rhnFault: (23, 'ORA-20290: (not_enough_entitlements_in_base_org) - You do not have enough entitlements in the base org.: org_id [1] family [rhn-tools] max [1]', 'Could not update database entry.')

Comment 4 Justin Sherrill 2011-01-04 22:14:05 UTC
Fixed in spacewalk master:  091e18bc8ab86835904f72e530cec58c5230ec0e

Comment 10 Florian Nadge 2011-01-14 11:03:35 UTC
Please be so kind and add a few key words to the Technical Notes of this
Bugzilla entry using the following structure:

Cause:

Consequence:

Fix:

Result:

For details, see:

https://bugzilla.redhat.com/page.cgi?id=fields.html#cf_release_notes

Thanks

Comment 11 Florian Nadge 2011-01-14 11:03:35 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause:

Consequence:

Fix:

Result:

Comment 12 Milan Zázrivec 2011-01-14 12:00:34 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,7 +1,8 @@
-Cause:
+Cause: Satellite certificate activation logic involving conversion of regular entitlements to flex entitlements did not restrict the conversion to a channel family and was
+converting all system's subscriptions.
 
-Consequence:
+Consequence: Satellite certificate activation would fail when converting regular system entitlements to flex entitlements for both the base and the child channels of the converted system.
 
-Fix:
+Fix: Satellite certificate activation logic was fixed to properly convert regular to flex entitlements in the critical cases.
 
-Result:+Result: Activation of a new Satellite certificate will correctly convert regular entitlements to flex entitlements for base and child channels of a system.

Comment 14 errata-xmlrpc 2011-01-17 21:19:59 UTC
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/RHBA-2011-0155.html