Bug 838658 - rhui manager creating entitlement certs for the wrong repos
Summary: rhui manager creating entitlement certs for the wrong repos
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Update Infrastructure for Cloud Providers
Classification: Red Hat
Component: RHUA
Version: 2.1
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ---
: ---
Assignee: wes hayutin
QA Contact: Martin Kočí
URL:
Whiteboard:
: 841256 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-09 17:42 UTC by wes hayutin
Modified: 2012-08-24 11:55 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Two separate repository lists were used by rhui-manager to display and track what repositories were selected during the creation of client entitlement certificate which led to a conflict. A repository list that is synchronised with what is displayed to the user has now been created to remove this error.
Clone Of:
Environment:
Last Closed: 2012-08-24 11:55:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patching log (16.02 KB, text/plain)
2012-07-20 06:51 UTC, mkovacik
no flags Details
screenshot (6.22 KB, text/plain)
2012-08-03 08:32 UTC, Martin Kočí
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2012:1205 0 normal SHIPPED_LIVE RHUI 2.1 Enhancement Update 2012-08-24 15:52:31 UTC

Description wes hayutin 2012-07-09 17:42:29 UTC
Description of problem:

Check the workflow in the following paste..
I'm trying to create an entitlement cert for three repos...
I'll try to recreate with a new content cert from access.redhat.com, the content cert I'm using is older.

x  1 : test_protected
x  12: Red Hat Enterprise Linux 6 Server from RHUI (RPMs)
x  14: Red Hat Update Infrastructure 2.0 (RPMs)

I end up w/ entitlements for:

  Custom Entitlements
    test_protected

  Red Hat Repositories
    Red Hat Enterprise Linux 6 Server - Optional from RHUI (RPMs)
    Red Hat Enterprise Linux 6 Server Beta from RHUI (Debug RPMs)


******************************************************************


-----------------------------------------------------------------------------
             -= Red Hat Update Infrastructure Management Tool =-


-= Client Entitlement Management =-

   e   generate an entitlement certificate
   c   create a client configuration RPM from an entitlement certificate

   logout
       removes stored authentication credentials and exits

   <   move to the previous screen
   ^, home
       move to the home screen
   /, clear
       clears the screen
   ?, help
       display help
   q, quit, exit
       exit

                                      Connected: ip-10-212-87-146.ec2.internal
------------------------------------------------------------------------------
rhui (client) => e

Select the CDS cluster that clients using this entitlement certificate will use to download content:

  1  - cluster01
Enter value (1-1) or 'b' to abort: 1

Select one or more repositories to include in the entitlement certificate:
(an * next to a Red Hat repository indicates it is deployed in the RHUI)

  Custom Repositories
    -  1 : test_protected
             test_protected


  Red Hat Repositories
    -  2 : Red Hat Enterprise Linux 6 Server - Optional Beta from RHUI (RPMs)
    -  3 : Red Hat Enterprise Linux 6 Server - Optional Beta from RHUI (Source RPMs)
    -  4 : Red Hat Enterprise Linux 6 Server - Optional Beta from RHUI(Debug RPMs)
    -  5 : Red Hat Enterprise Linux 6 Server - Optional from RHUI (Debug RPMs)
    -  6 : Red Hat Enterprise Linux 6 Server - Optional from RHUI (RPMs)
    -  7 : Red Hat Enterprise Linux 6 Server - Optional from RHUI (Source RPMs)
    -  8 : Red Hat Enterprise Linux 6 Server Beta from RHUI (Debug RPMs)
    -  9 : Red Hat Enterprise Linux 6 Server Beta from RHUI (RPMs)
    -  10: Red Hat Enterprise Linux 6 Server Beta from RHUI (Source RPMs)
    -  11: Red Hat Enterprise Linux 6 Server from RHUI (Debug RPMs)
    -  12: Red Hat Enterprise Linux 6 Server from RHUI (RPMs)
    -  13: Red Hat Enterprise Linux 6 Server from RHUI (Source RPMs)
    -  14: Red Hat Update Infrastructure 2.0 (RPMs)
    -  15: Red Hat Update Infrastructure 2.0 (Source RPMs)

Enter value (1-15) to toggle selection, 'c' to confirm selections, or '?' for more commands: 1

Select one or more repositories to include in the entitlement certificate:
(an * next to a Red Hat repository indicates it is deployed in the RHUI)

  Custom Repositories
    x  1 : test_protected
             test_protected


  Red Hat Repositories
    -  2 : Red Hat Enterprise Linux 6 Server - Optional Beta from RHUI (RPMs)
    -  3 : Red Hat Enterprise Linux 6 Server - Optional Beta from RHUI (Source RPMs)
    -  4 : Red Hat Enterprise Linux 6 Server - Optional Beta from RHUI(Debug RPMs)
    -  5 : Red Hat Enterprise Linux 6 Server - Optional from RHUI (Debug RPMs)
    -  6 : Red Hat Enterprise Linux 6 Server - Optional from RHUI (RPMs)
    -  7 : Red Hat Enterprise Linux 6 Server - Optional from RHUI (Source RPMs)
    -  8 : Red Hat Enterprise Linux 6 Server Beta from RHUI (Debug RPMs)
    -  9 : Red Hat Enterprise Linux 6 Server Beta from RHUI (RPMs)
    -  10: Red Hat Enterprise Linux 6 Server Beta from RHUI (Source RPMs)
    -  11: Red Hat Enterprise Linux 6 Server from RHUI (Debug RPMs)
    -  12: Red Hat Enterprise Linux 6 Server from RHUI (RPMs)
    -  13: Red Hat Enterprise Linux 6 Server from RHUI (Source RPMs)
    -  14: Red Hat Update Infrastructure 2.0 (RPMs)
    -  15: Red Hat Update Infrastructure 2.0 (Source RPMs)

Enter value (1-15) to toggle selection, 'c' to confirm selections, or '?' for more commands: 12

Select one or more repositories to include in the entitlement certificate:
(an * next to a Red Hat repository indicates it is deployed in the RHUI)

  Custom Repositories
    x  1 : test_protected
             test_protected


  Red Hat Repositories
    -  2 : Red Hat Enterprise Linux 6 Server - Optional Beta from RHUI (RPMs)
    -  3 : Red Hat Enterprise Linux 6 Server - Optional Beta from RHUI (Source RPMs)
    -  4 : Red Hat Enterprise Linux 6 Server - Optional Beta from RHUI(Debug RPMs)
    -  5 : Red Hat Enterprise Linux 6 Server - Optional from RHUI (Debug RPMs)
    -  6 : Red Hat Enterprise Linux 6 Server - Optional from RHUI (RPMs)
    -  7 : Red Hat Enterprise Linux 6 Server - Optional from RHUI (Source RPMs)
    -  8 : Red Hat Enterprise Linux 6 Server Beta from RHUI (Debug RPMs)
    -  9 : Red Hat Enterprise Linux 6 Server Beta from RHUI (RPMs)
    -  10: Red Hat Enterprise Linux 6 Server Beta from RHUI (Source RPMs)
    -  11: Red Hat Enterprise Linux 6 Server from RHUI (Debug RPMs)
    x  12: Red Hat Enterprise Linux 6 Server from RHUI (RPMs)
    -  13: Red Hat Enterprise Linux 6 Server from RHUI (Source RPMs)
    -  14: Red Hat Update Infrastructure 2.0 (RPMs)
    -  15: Red Hat Update Infrastructure 2.0 (Source RPMs)

Enter value (1-15) to toggle selection, 'c' to confirm selections, or '?' for more commands: 14

Select one or more repositories to include in the entitlement certificate:
(an * next to a Red Hat repository indicates it is deployed in the RHUI)

  Custom Repositories
    x  1 : test_protected
             test_protected


  Red Hat Repositories
    -  2 : Red Hat Enterprise Linux 6 Server - Optional Beta from RHUI (RPMs)
    -  3 : Red Hat Enterprise Linux 6 Server - Optional Beta from RHUI (Source RPMs)
    -  4 : Red Hat Enterprise Linux 6 Server - Optional Beta from RHUI(Debug RPMs)
    -  5 : Red Hat Enterprise Linux 6 Server - Optional from RHUI (Debug RPMs)
    -  6 : Red Hat Enterprise Linux 6 Server - Optional from RHUI (RPMs)
    -  7 : Red Hat Enterprise Linux 6 Server - Optional from RHUI (Source RPMs)
    -  8 : Red Hat Enterprise Linux 6 Server Beta from RHUI (Debug RPMs)
    -  9 : Red Hat Enterprise Linux 6 Server Beta from RHUI (RPMs)
    -  10: Red Hat Enterprise Linux 6 Server Beta from RHUI (Source RPMs)
    -  11: Red Hat Enterprise Linux 6 Server from RHUI (Debug RPMs)
    x  12: Red Hat Enterprise Linux 6 Server from RHUI (RPMs)
    -  13: Red Hat Enterprise Linux 6 Server from RHUI (Source RPMs)
    x  14: Red Hat Update Infrastructure 2.0 (RPMs)
    -  15: Red Hat Update Infrastructure 2.0 (Source RPMs)

Enter value (1-15) to toggle selection, 'c' to confirm selections, or '?' for more commands: c


Name of the certificate. This will be used as the name of the certificate file
(name.crt) and its associated private key (name.key). Choose something that will
help identify the products contained with it:
test2_protected

Local directory in which to save the generated certificate [current directory]:
/tmp/test2_protected

Number of days the certificate should be valid [365]:


Repositories to be included in the entitlement certificate:

  Custom Entitlements
    test_protected

  Red Hat Repositories
    Red Hat Enterprise Linux 6 Server - Optional from RHUI (RPMs)
    Red Hat Enterprise Linux 6 Server Beta from RHUI (Debug RPMs)

Proceed? (y/n) y




*** rh-rhui-tools-2.0.68-1.el6_3.noarch.rpm

Comment 1 wes hayutin 2012-07-09 17:51:08 UTC
this issue is reflected in the client:
[root@ip-10-40-54-189 ~]# yum repolist
Loaded plugins: product-id, rhui-lb, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
repo id                               repo name                                                      status
rhui-custom-10000                     Custom Repositories - 10000                                        0
rhui-rhel-6-server-rhui-optional-rpms Red Hat Enterprise Linux 6 Server - Optional from RHUI (RPMs)  5,109

Comment 2 wes hayutin 2012-07-10 01:43:35 UTC
So I've tested this patch and it appears to fix the problem.
The issue was two separate lists were used to display and track what repos were selected.  I've added a third list that is in sync w/ what is displayed to the user..


diff --git a/rhui-2.0/tools/src/rhui/tools/screens/client.py b/rhui-2.0/tools/src/rhui/tools/screens/client.py
index 7e3790d..c17eef8 100644
--- a/rhui-2.0/tools/src/rhui/tools/screens/client.py
+++ b/rhui-2.0/tools/src/rhui/tools/screens/client.py
@@ -60,6 +60,7 @@ class ClientScreen(Screen):
         # Load entitlement certificate
         redhat_ents = self.cert_manager.valid_entitlements()
         redhat_ents = sorted(redhat_ents, key=lambda ent: ent.name)
+        redhat_ents_filtered = []
 
         # Cross reference with Red Hat repos deployed in the RHUI to mark them
         # specifically
@@ -72,6 +73,7 @@ class ClientScreen(Screen):
             if len([repo for repo in cluster_repos \
                     if e.label in repo['groupid']]):
                 redhat_ent_names.append(name)
+                redhat_ents_filtered.append(e)
         
         # Load custom repositories and generate display names for the menu
         ent_repo_mappings = self.pulp.custom_repo_entitlements()
@@ -85,7 +87,7 @@ class ClientScreen(Screen):
             # List each repo for that path underneath it, indented to match 
             # the menu
             for repo in ent.repos:
-                if repo['repo_id'] not in cluster['repo_ids']:
+                if repo['id'] not in cluster['repo_ids']:
                     continue
                 menu_item += '             %s\n' % repo['name']
 
@@ -122,7 +124,7 @@ class ClientScreen(Screen):
             return
 
         # Map selected indices back to ent objects
-        redhat_selected_ents = [redhat_ents[index] for index in selected_section_indices[redhat_section_name]]
+        redhat_selected_ents = [redhat_ents_filtered[index] for index in selected_section_indices[redhat_section_name]]
         custom_selected_ents = [custom_ents[index] for index in selected_section_indices[custom_section_name]]

Comment 3 wes hayutin 2012-07-10 01:52:54 UTC
cloude ae1789aaabf07247f2d5f72e93dd426a72b0a86b

Comment 4 wes hayutin 2012-07-18 18:34:24 UTC
*** Bug 841256 has been marked as a duplicate of this bug. ***

Comment 5 mkovacik 2012-07-20 06:51:23 UTC
Created attachment 599317 [details]
Patching log

The patch from comment 2 solves the issue indeed. Applied to rh-rhui-tools of version: 2.0.68. See the attachment for screen log of a client certificate being generated with the patch applied...

Comment 6 Martin Kočí 2012-08-03 08:32:26 UTC
Created attachment 602083 [details]
screenshot

Verified against /root/RHEL-6.3-RHUI-2.1-20120801.0-Server-x86_64-DVD1.iso. For further info see attachment. 

Moving bug to VERIFIED.

Comment 7 sachua 2012-08-15 04:47:19 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:
Two separate repository lists were used by rhui-manager to display and track what repositories were selected during the creation of client entitlement certificate which led to a conflict. A repository list that is synchronised with what is displayed to the user has now been created to remove this error.

Comment 9 errata-xmlrpc 2012-08-24 11:55:12 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.

http://rhn.redhat.com/errata/RHEA-2012-1205.html


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