Bug 951985 - beaker-import explodes on failure to import a distro tree where the exception message contains %
Summary: beaker-import explodes on failure to import a distro tree where the exception...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: lab controller
Version: 0.12
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 0.13
Assignee: Raymond Mancy
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-04-15 01:21 UTC by Dan Callaghan
Modified: 2018-02-06 00:41 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-06-25 06:27:23 UTC
Embargoed:


Attachments (Terms of Use)

Description Dan Callaghan 2013-04-15 01:21:37 UTC
Traceback (most recent call last):
  File "/usr/bin/beaker-import", line 9, in <module>
    load_entry_point('bkr.labcontroller==0.12.0', 'console_scripts', 'beaker-import')()
  File "/usr/lib/python2.6/site-packages/bkr/labcontroller/distro_import.py", line 1879, in main
    build.process(urls, opts)
  File "/usr/lib/python2.6/site-packages/bkr/labcontroller/distro_import.py", line 1734, in process
    raise BX('failed to add %s to beaker: %s' % (self.tree['name'],e))
  File "/usr/lib/python2.6/site-packages/bkr/common/bexceptions.py", line 4, in __init__
    self.value = value % args
TypeError: not enough arguments for format string

Exception is from bug 951981, the server-side exception contained a % from the parametrised MySQL query string from sqlalchemy.

I actually never noticed this behaviour in BX's constructor before, it's a little bit unconventional/unexpected. It means we may need to audit all usages of it to check for this same problem (passing non-constant strings as the message).

Comment 1 Raymond Mancy 2013-04-16 01:26:08 UTC
http://gerrit.beaker-project.org/#/c/1884/

Comment 3 xjia 2013-05-30 06:01:50 UTC
Base on https://bugzilla.redhat.com/show_bug.cgi?id=951981#c4 and I also check the code from beaker-devel environment. 
[root@lab-devel-03 ~]# cat  /usr/lib/python2.6/site-packages/bkr/common/bexceptions.py
class BeakerException(Exception):

   def __init__(self, value):
       self.value = value

   def __str__(self):
       return repr(self.value)

class BX(BeakerException):
   pass

Version:
[root@lab-devel-03 ~]# rpm -qf /usr/lib/python2.6/site-packages/bkr/common/bexceptions.py
beaker-0.12.1-1.git.133.6c74a92.el6.noarch

Comment 5 Amit Saha 2013-06-25 06:27:23 UTC
Beaker 0.13.1 has been released.


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