Bug 1350959 - Uncaought IOError when cert file missing, HubProxy.__del__ AttributeError
Summary: Uncaought IOError when cert file missing, HubProxy.__del__ AttributeError
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: command line
Version: 22
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: 23.2
Assignee: Roman Joost
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-28 20:23 UTC by mulhern
Modified: 2020-07-27 08:37 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-09-02 07:01:23 UTC
Embargoed:


Attachments (Terms of Use)

Description mulhern 2016-06-28 20:23:45 UTC
Description of problem:

Stack trace when cert file missing:

[mulhern@dhcp-25-209 ~]$ bkr whoami
Traceback (most recent call last):
  File "/usr/bin/bkr", line 9, in <module>
    load_entry_point('bkr.client==22.1', 'console_scripts', 'bkr')()
  File "/usr/lib/python2.7/site-packages/bkr/client/main.py", line 72, in main
    return cmd.run(*cmd_args, **cmd_opts.__dict__)
  File "/usr/lib/python2.7/site-packages/bkr/client/commands/cmd_whoami.py", line 56, in run
    self.set_hub(**kwargs)
  File "/usr/lib/python2.7/site-packages/bkr/client/__init__.py", line 71, in set_hub
    proxy_user=proxy_user)
  File "/usr/lib/python2.7/site-packages/bkr/client/command.py", line 279, in set_hub
    self.hub = HubProxy(conf=self.conf, auto_login=auto_login)
  File "/usr/lib/python2.7/site-packages/bkr/common/hub.py", line 57, in __init__
    ssl_context.load_verify_locations(cafile=self._conf['CA_CERT'])
IOError: [Errno 2] No such file or directory
Exception AttributeError: AttributeError("'HubProxy' object has no attribute '_transport'",) in <bound method HubProxy.__del__ of <bkr.common.hub.HubProxy object at 0x7f45c09a6410>> ignored


Version-Release number of selected component (if applicable):

22.1

How reproducible:

Always.

Steps to Reproduce:
1. Don't actually have a file corresponding to CA_CERT variable in comfig.
2. > bkr whoami
3. Observe stack trace.

Actual results:

Stack trace.

Expected results:

Something a little more confidence inspiring and perhaps more informative. No AttributeError.

Additional info:

Note the AttributeError...it seems like the HubProxy object is not fully constructed, so the __del__ method fails. Maybe necessary to be more conservative there.

Comment 3 Roman Joost 2016-07-14 00:00:45 UTC
I can reproduce the problem. If CA_CERT in the configuration points to a non-existing file I run into the same Traceback.

Comment 4 Roman Joost 2016-07-14 01:01:07 UTC
Took a chance of catching this problem before bkr connects to the hub... not sure if I found the right spot. So patch is up

http://gerrit.beaker-project.org/5060

Comment 5 Dan Callaghan 2016-07-22 06:45:04 UTC
This bug fix is included in beaker-client-23.1-0.git.12.aa72972 which is currently available for download here:

https://beaker-project.org/nightlies/release-23/

Comment 7 Dan Callaghan 2016-08-08 01:06:26 UTC
(In reply to wangdong from comment #6)
> [root@dhcp-140-87 tmp]# bkr whoami
> Traceback (most recent call last):
>   File "/usr/bin/bkr", line 9, in <module>
>     load_entry_point('bkr.client==23.1.git.12.aa72972', 'console_scripts',
> 'bkr')()
>   File "/usr/lib/python2.6/site-packages/bkr/client/main.py", line 83, in
> main
>     return cmd.run(*cmd_args, **cmd_opts.__dict__)
>   File "/usr/lib/python2.6/site-packages/bkr/client/commands/cmd_whoami.py",
> line 56, in run
>     self.set_hub(**kwargs)
>   File "/usr/lib/python2.6/site-packages/bkr/client/__init__.py", line 73,
> in set_hub
>     proxy_user=proxy_user)
>   File "/usr/lib/python2.6/site-packages/bkr/client/command.py", line 282,
> in set_hub
>     self.error('CA_CERT configuration points to non-existing file: %s' %
> cacert)
> AttributeError: 'BeakerCommandContainer' object has no attribute 'error'

Just noticed this... This is not the expected result. Looks like a typo, should be self.parser.error() I think.

The expected result is a nice error message saying:

CA_CERT configuration points to non-existing file: /etc/whatever

not a traceback.

Comment 8 Roman Joost 2016-08-09 01:40:16 UTC
*doh My fault for missing this. New patch:

https://gerrit.beaker-project.org/#/c/5123/

Comment 9 Dan Callaghan 2016-08-29 07:00:03 UTC
This bug fix is included in beaker-client-23.2-0.git.12.5a78967 which is currently available for download here:

https://beaker-project.org/nightlies/release-23/

Comment 11 Dan Callaghan 2016-09-02 07:01:23 UTC
Beaker 23.2 has been released.


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