Note: There are a few cases of duplicates in user autocompletion which are being worked on.

cannot add permissions that don't have options set

RESOLVED FIXED

Status

Release Engineering
Balrog: Backend
RESOLVED FIXED
11 months ago
10 months ago

People

(Reporter: bhearsum, Assigned: bhearsum)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

11 months ago
Rail noticed this while trying to grant Johan admin permissions. In production, it shows up as a 502 (which is a bit strange). I was able to reproduce locally, and got:
balrogadmin_1 | 2016-08-24 17:37:02,995 - DEBUG - PID: 102 - Request: 139838539774992 - Permissions.insert#1657: granting admin to foobar with options {}
balrogadmin_1 | Traceback (most recent call last):
balrogadmin_1 |   File "./auslib/admin/views/base.py", line 69, in put
balrogadmin_1 |     return self._put(*args, transaction=trans, **kwargs)
balrogadmin_1 |   File "./auslib/admin/views/base.py", line 19, in decorated
balrogadmin_1 |     return f(*args, changed_by=username, **kwargs)
balrogadmin_1 |   File "./auslib/admin/views/permissions.py", line 57, in _put
balrogadmin_1 |     dbo.permissions.insert(changed_by, transaction=transaction, username=username, permission=permission, options=form.options.data)
balrogadmin_1 |   File "./auslib/db.py", line 1658, in insert
balrogadmin_1 |     super(Permissions, self).insert(changed_by=changed_by, transaction=transaction, **columns)
balrogadmin_1 |   File "./auslib/db.py", line 325, in insert
balrogadmin_1 |     return self._prepareInsert(transaction, changed_by, **columns)
balrogadmin_1 |   File "./auslib/db.py", line 301, in _prepareInsert
balrogadmin_1 |     ret = trans.execute(query)
balrogadmin_1 |   File "./auslib/db.py", line 122, in execute
balrogadmin_1 |     return self.conn.execute(statement)
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1358, in execute
balrogadmin_1 |     params)
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1491, in _execute_clauseelement
balrogadmin_1 |     compiled_sql, distilled_params
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1599, in _execute_context
balrogadmin_1 |     context)
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1592, in _execute_context
balrogadmin_1 |     context)
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 325, in do_execute
balrogadmin_1 |     cursor.execute(statement, parameters)
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 174, in execute
balrogadmin_1 |     self.errorhandler(self, exc, value)
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
balrogadmin_1 |     raise errorclass, errorvalue
balrogadmin_1 | TransactionError: ('(ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'}, 1)\' at line 1")',)


If I hack the code and remove "options" from what's about to get inserted, it works fine. Without that hack, I can still add permissions as long as they have "options" set.

This is likely a regression from https://bugzilla.mozilla.org/show_bug.cgi?id=1246675.
(Assignee)

Comment 1

11 months ago
Created attachment 8787285 [details] [review]
fix default value for options
Attachment #8787285 - Flags: review?(rail)
Comment on attachment 8787285 [details] [review]
fix default value for options

lgtm
Attachment #8787285 - Flags: review?(rail) → review+

Comment 3

11 months ago
Commit pushed to master at https://github.com/mozilla/balrog

https://github.com/mozilla/balrog/commit/49dd520555c18d68b4f11c4c29b5c07849095452
bug 1297765: Use different default value for permission options. (#117). r=rail
(Assignee)

Updated

10 months ago
Depends on: 1302450
(Assignee)

Comment 4

10 months ago
This made it to production today.
Status: NEW → RESOLVED
Last Resolved: 10 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.