Bug 787763

Summary: Creating a custom repo with entitlement certs generates KeyError: 'entitlement-path'
Product: Red Hat Update Infrastructure for Cloud Providers Reporter: Sachin Ghai <sghai>
Component: RHUAAssignee: James Slagle <jslagle>
Status: CLOSED CURRENTRELEASE QA Contact: wes hayutin <whayutin>
Severity: high Docs Contact:
Priority: unspecified    
Version: 2.0.2CC: kbidarka, mkovacik, sghai, tsanders
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-12 19:40:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Sachin Ghai 2012-02-06 16:54:20 UTC
Description of problem:
Creatinga custom repo with entitlement certs generates KeyError: 'entitlement-path'

Version-Release number of selected component (if applicable):
RHEL-6.2-RHUI-2.0.2-20120203.1-Server-x86_64-DVD1.iso

How reproducible:
always

Steps to Reproduce:
1. rhui-manager => r ==> c
2. Create a custom repo with entitlement certs
3.
  
Actual results:
KeyError: 'entitlement-path'


Expected results:
RHUI-manager should create the custom repo successfully

Additional info:

----------
rhui (repo) => c

Unique ID for the custom repository (alphanumerics, _, and - only):
custom_001

Display name for the custom repository [custom_001]:
pulp

Path at which the repository will be served [custom_001]:
/protected/custom/

Algorithm to use when calculating the checksum values for repository metadata:
  1  - sha256
  2  - sha1
Enter value (1-2) or 'b' to abort: 1

Should the repository require an entitlement certificate to access? (y/n)
y


An unexpected error has occurred during the last operation.
More information can be found in /root/.rhui/rhui.log.

----------------------------------------

tail -f /root/.rhui/rhui.log
Unexpected error caught at the shell level
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/rhui/tools/shell.py", line 87, in safe_listen
    self.listen(clear=first_run)
  File "/usr/lib/python2.6/site-packages/rhui/tools/shell.py", line 113, in listen
    Shell.listen(self)
  File "/usr/lib/python2.6/site-packages/rhui/common/shell.py", line 191, in listen
    item.func(*args, **item.kwargs)
  File "/usr/lib/python2.6/site-packages/rhui/tools/screens/repo.py", line 398, in create_custom
    educated_guess = self._entitlement_guess(path)
  File "/usr/lib/python2.6/site-packages/rhui/tools/screens/repo.py", line 439, in _entitlement_guess
    entitlement_map = self.pulp.custom_repo_entitlements()
  File "/usr/lib/python2.6/site-packages/rhui/tools/pulp_api.py", line 805, in custom_repo_entitlements
    repo_path = repo['notes'][ENTITLEMENT_PATH]
KeyError: 'entitlement-path'

Comment 1 Sachin Ghai 2012-02-06 16:57:13 UTC
I think issue is with both with or without entitlement certs.

If I create custom repo without entitlement certs then a different error is raised.


----
rhui (repo) => c

Unique ID for the custom repository (alphanumerics, _, and - only):
custom

Display name for the custom repository [custom]:
pulp

Path at which the repository will be served [custom]:


Algorithm to use when calculating the checksum values for repository metadata:
  1  - sha256
  2  - sha1
Enter value (1-2) or 'b' to abort: 1

Should the repository require an entitlement certificate to access? (y/n)
n

The following repository will be created:
  ID:          custom
  Name:        pulp
  Path:        custom
Proceed? (y/n) y
-----


rhui.log:
========

Unexpected error caught at the shell level
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/rhui/tools/shell.py", line 87, in safe_listen
    self.listen(clear=first_run)
  File "/usr/lib/python2.6/site-packages/rhui/tools/shell.py", line 113, in listen
    Shell.listen(self)
  File "/usr/lib/python2.6/site-packages/rhui/common/shell.py", line 191, in listen
    item.func(*args, **item.kwargs)
  File "/usr/lib/python2.6/site-packages/rhui/tools/screens/repo.py", line 419, in create_custom
    success = self.pulp.create_custom_repo(id, name, path, entitlement_path, protected, checksum_type)
  File "/usr/lib/python2.6/site-packages/rhui/tools/pulp_api.py", line 373, in create_custom_repo
    notes=notes, checksum_type=checksum_type)
TypeError: create() got an unexpected keyword argument 'notes'

Comment 2 James Slagle 2012-02-06 21:19:26 UTC
committed fix to rh-rhui-tools: 0c7277d4310ee95e2b5ad26a7c7b614885f835f9

Comment 3 James Slagle 2012-02-06 21:20:05 UTC
*** Bug 787790 has been marked as a duplicate of this bug. ***

Comment 4 James Slagle 2012-02-06 21:34:24 UTC
The fix has been built into a new rh-rhui-tools.  You can install it from:
http://download.devel.redhat.com/brewroot/packages/rh-rhui-tools/2.0.53/1.el6/noarch/rh-rhui-tools-2.0.53-1.el6.noarch.rpm

Comment 5 Sachin Ghai 2012-02-07 11:20:33 UTC
After updating the rh-rhui-tools rpm from the location in comment3, I can create custom repo with and without entitlement certs.

without entitlement cert:
=======================

------------------------------------------------------------------------------
rhui (repo) => c

Unique ID for the custom repository (alphanumerics, _, and - only):
custom_002

Display name for the custom repository [custom_002]:
pulp_001     

Path at which the repository will be served [custom_002]:


Algorithm to use when calculating the checksum values for repository metadata:
  1  - sha256
  2  - sha1
Enter value (1-2) or 'b' to abort: 2

Should the repository require an entitlement certificate to access? (y/n)
n

The following repository will be created:
  ID:          custom_002
  Name:        pulp_001
  Path:        custom_002
Proceed? (y/n) y

Successfully created repository pulp_001

------------------------------------------------------------------------------

Comment 6 Sachin Ghai 2012-02-07 11:21:57 UTC
With entitlement certs:
=====================

------------------------------------------------------------------------------
rhui (repo) => c

Unique ID for the custom repository (alphanumerics, _, and - only):
custom_001

Display name for the custom repository [custom_001]:
pulp

Path at which the repository will be served [custom_001]:
/protected/   

Algorithm to use when calculating the checksum values for repository metadata:
  1  - sha256
  2  - sha1
Enter value (1-2) or 'b' to abort: 1

Should the repository require an entitlement certificate to access? (y/n)
y

Path that should be used when granting an entitlement for this repository. This
may use yum variable substitutions (e.g. $basearch) to group this together with
other repositories that share the entitlement [/protected/]:


The following repository will be created:
  ID:          custom_001
  Name:        pulp
  Path:        /protected/
  Entitlement: /protected/
Proceed? (y/n) y

Successfully created repository pulp

------------------------------------------------------------------------------



listing of repos:
======================

Custom Repositories
  pulp
  pulp_001

Red Hat Repositories
  Red Hat Update Infrastructure 2.0 (RPMs) (6Server-x86_64)


------------------------------------------------------------------------------
rhui (repo) =>

Comment 7 James Slagle 2012-03-12 19:40:14 UTC
Released in RHUI 2.0.2

Comment 8 James Slagle 2012-03-12 19:45:50 UTC
*** Bug 787790 has been marked as a duplicate of this bug. ***