Bug 1584527

Summary: RFE: Easier debugging of invalid entitlement certificates
Product: Red Hat Update Infrastructure for Cloud Providers Reporter: Radek Bíba <rbiba>
Component: ToolsAssignee: RHUI Bug List <rhui-bugs>
Status: CLOSED ERRATA QA Contact: Vratislav Hutsky <vhutsky>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.0.3CC: mkubik, mminar
Target Milestone: 3.0.4Keywords: FutureFeature
Target Release: 3.0.x   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Rebase: Bug Fixes and Enhancements
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-07-10 16:00:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Radek Bíba 2018-05-31 07:10:54 UTC
Description of problem:
When you try to upload an invalid certificate, rhui-manager only provides the following error message:

The given certificate contains one or more entitlements that are
not compatible with the RHUI. For questions, please visit:
https://access.redhat.com/support/contact/customerService.html

User experience would be much better, and troubleshooting could start more efficiently, if the error message included the entitlement that wasn't compatible.

While trying to understand the recent issue brought up by Tapomoy, I (also) made the following change to /usr/lib/python2.7/site-packages/rhui/tools/cert_manager.py to force the responsible method to tell me which URL failed to validate against the predefined pattern, instead of just returning True/False:

def _is_valid_download_url(download_url):
<snip>
#    return fnmatch.fnmatch(download_url, VALID_URL_PATTERN)
    if fnmatch.fnmatch(download_url, VALID_URL_PATTERN):
        return True
    else:
        print download_url
        return False

The next attempt to upload the questionable pem file then produced:

# rhui-manager cert upload --cert /tmp/4361937509242360488.pem 
/content/eus/rhel/server/7/$releasever/$basearch/sap/os
The given certificate contains one or more entitlements that are
not compatible with the RHUI. For questions, please visit:
https://access.redhat.com/support/contact/customerService.html

Sure enough, it's not neat at all, but it helps. Please modify the code as appropriate to make rhui-manager explain -- print/log -- nicely which (first) entitlement is incompatible.

Version-Release number of selected component (if applicable):
rh-rhui-tools-3.0.3-3.el7ui.noarch

Comment 7 errata-xmlrpc 2018-07-10 16:00:36 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.

https://access.redhat.com/errata/RHBA-2018:2153