Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 588886 - dev-python/libzilla-1.2: shell crashes on libzilla.exceptions.LibZillaException exception
Summary: dev-python/libzilla-1.2: shell crashes on libzilla.exceptions.LibZillaExcepti...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Patrice Clement
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-15 14:24 UTC by nvinson234
Modified: 2016-07-15 23:26 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nvinson234 2016-07-15 14:24:54 UTC
Give libzilla a bad username and/or password and it crashes the shell (in my case I did both).

Welcome to the Libzilla Shell!

For a complete list of commands, type help.
The current bug report # is username234.

List of bug reports for this session: username234
> [2016-07-15 07:02:56,530][libzilla.configmanager][INFO]: File "/home/nvinson/.libzillarc" not found! Prompt user for credentials.
Bugzilla URL: Username: OK! Let's recap:
URL: bugs.gentoo.org
Username: nvinson
Password: ***
Are these settings correct? [y/n] [2016-07-15 07:03:06,893][libzilla.validator][INFO]: HTTPS scheme not detected!
[2016-07-15 07:03:06,893][libzilla.validator][INFO]: Defaulting scheme to 'https'.
[2016-07-15 07:03:06,893][libzilla.validator][INFO]: URL must point to the REST API!
[2016-07-15 07:03:06,893][libzilla.validator][INFO]: Defaulting path to 'rest'.
[2016-07-15 07:03:06,893][libzilla.validator][INFO]: Validated URL: https://bugs.gentoo.org/rest
Would you like to record these settings in /home/nvinson/.libzillarc? [y/n]
[2016-07-15 07:03:09,975][libzilla.configmanager][INFO]: Keeping settings in memory for the remaining of the session.
[2016-07-15 07:03:09,975][libzilla.connection][INFO]: Logging in ...
[2016-07-15 07:03:09,987][requests.packages.urllib3.connectionpool][INFO]: Starting new HTTPS connection (1): bugs.gentoo.org
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.4/lzilla", line 9, in <module>
    load_entry_point('libzilla==1.0', 'console_scripts', 'lzilla')()
  File "/usr/lib64/python3.4/site-packages/libzilla/__main__.py", line 6, in main
    libzilla.basecommand.BaseCommand()
  File "/usr/lib64/python3.4/site-packages/libzilla/basecommand.py", line 43, in __init__
    runner[args['<command>']]()
  File "/usr/lib64/python3.4/site-packages/libzilla/basecommand.py", line 58, in run_shell_command
    ShellCommand(docopt(ShellCommand.__doc__)).cmdloop()
  File "/usr/lib64/python3.4/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib64/python3.4/cmd.py", line 217, in onecmd
    return func(arg)
  File "/usr/lib64/python3.4/site-packages/libzilla/cli/shell.py", line 122, in do_query
    self.session.connect()
  File "/usr/lib64/python3.4/site-packages/libzilla/session.py", line 47, in connect
    self.conn.login()
  File "/usr/lib64/python3.4/site-packages/libzilla/connection.py", line 65, in login
    response = self.send_request('GET', url)
  File "/usr/lib64/python3.4/site-packages/libzilla/connection.py", line 52, in send_request
    raise LibZillaException(response.reason)
libzilla.exceptions.LibZillaException: Authorization Required
Comment 1 Patrice Clement gentoo-dev 2016-07-15 23:26:42 UTC
commit ab702b6aef935603459e76384ba71f20d2872be6 (HEAD -> master, origin/master)
Author:     Patrice Clement <monsieurp@gentoo.org>
AuthorDate: Sat Jul 16 01:13:36 2016 +0200
Commit:     Patrice Clement <monsieurp@gentoo.org>
CommitDate: Sat Jul 16 01:13:36 2016 +0200

Rework how exceptions are thrown.

Basically, I got rid of the LibzillaException class since it turns out to be
useless and replaced it with a warning followed by a program exit afterwards
(exit(1)).

I still don't like some bits especially the design of session.py which is awful
imo but we'll make do for the time being.

Gentoo-Bug: https://bugs.gentoo.org/588888
Gentoo-Bug: https://bugs.gentoo.org/588886

libzilla/connection.py  | 96 ++++++++++++++++++++++++++++++-------------------
libzilla/exceptions.py  |  3 --
libzilla/promptmaker.py |  2 +-
libzilla/session.py     |  5 ---
libzilla/validator.py   |  5 +--
5 files changed, 63 insertions(+), 48 deletions(-)
delete mode 100644 libzilla/exceptions.py