Bug 1519862

Summary: rhui-manager cert upload (CLI) doesn't handle an expired certificate well
Product: Red Hat Update Infrastructure for Cloud Providers Reporter: Radek Bíba <rbiba>
Component: ToolsAssignee: Martin Minar <mminar>
Status: CLOSED ERRATA QA Contact: Vratislav Hutsky <vhutsky>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.0.0CC: lwilliam, mminar
Target Milestone: 3.0.4Flags: mminar: needinfo?
Target Release: 3.0.x   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
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 2017-12-01 15:01:23 UTC
Description of problem:
When I try uploading an expired certificate in the interactive mode, I get this proper error message:

The provided certificate is expired or invalid.  Please upload a valid one

I'd expect a similar response in the CLI, but here's what actually happens:

[root@rhua ~]# rhui-manager cert upload --cert shortlivedcert.pem 

An unexpected error has occurred during the last operation.


[root@rhua ~]#

When I look at the end of /root/.rhui/rhui.log, I find this:

2017-12-01 14:54:54,516 - Connecting to RHUA [rhua.example.com]...
2017-12-01 14:54:54,520 - Successfully connected to [rhua.example.com]
2017-12-01 14:54:54,522 - This certificate is invalid or expired.
None
2017-12-01 14:54:54,522 - Unexpected error caught at the shell level
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/rhui/tools/cli.py", line 66, in run
    Cli.run(self, args)
  File "/usr/lib/python2.7/site-packages/rhui/common/cli.py", line 272, in run
    command_or_section.execute(remaining_args)
  File "/usr/lib/python2.7/site-packages/rhui/common/cli.py", line 113, in execute
    self.method(**arg_dict)
  File "/usr/lib/python2.7/site-packages/rhui/tools/commands/cert.py", line 57, in upload
    self._upload_cert(valid_cert_filename)
  File "/usr/lib/python2.7/site-packages/rhui/tools/commands/cert.py", line 101, in _upload_cert
    self.cert_manager.add_certificate(valid_cert_filename)
  File "/usr/lib/python2.7/site-packages/rhui/tools/cert_manager.py", line 273, in add_certificate
    raise InvalidOrExpiredCertificate()
InvalidOrExpiredCertificate
2017-12-01 14:54:54,523 - 
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/rhui/tools/cli.py", line 66, in run
    Cli.run(self, args)
  File "/usr/lib/python2.7/site-packages/rhui/common/cli.py", line 272, in run
    command_or_section.execute(remaining_args)
  File "/usr/lib/python2.7/site-packages/rhui/common/cli.py", line 113, in execute
    self.method(**arg_dict)
  File "/usr/lib/python2.7/site-packages/rhui/tools/commands/cert.py", line 57, in upload
    self._upload_cert(valid_cert_filename)
  File "/usr/lib/python2.7/site-packages/rhui/tools/commands/cert.py", line 101, in _upload_cert
    self.cert_manager.add_certificate(valid_cert_filename)
  File "/usr/lib/python2.7/site-packages/rhui/tools/cert_manager.py", line 273, in add_certificate
    raise InvalidOrExpiredCertificate()
InvalidOrExpiredCertificate

But I only look there because I already know where to look. Please allow the CLI to print an error message that says it all, or at lease add the location of this log file to the current error message (such as Please check ~/.rhui/rhui.log for more details.)

Version-Release number of selected component (if applicable):
rh-rhui-tools-3.0.1-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