Closed Bug 1297765 Opened 4 years ago Closed 3 years ago

cannot add permissions that don't have options set


(Release Engineering Graveyard :: Applications: Balrog (backend), defect, P1)



(Not tracked)



(Reporter: bhearsum, Assigned: bhearsum)




(2 files)

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/", line 69, in put
balrogadmin_1 |     return self._put(*args, transaction=trans, **kwargs)
balrogadmin_1 |   File "./auslib/admin/views/", line 19, in decorated
balrogadmin_1 |     return f(*args, changed_by=username, **kwargs)
balrogadmin_1 |   File "./auslib/admin/views/", line 57, in _put
balrogadmin_1 |     dbo.permissions.insert(changed_by, transaction=transaction, username=username, permission=permission,
balrogadmin_1 |   File "./auslib/", line 1658, in insert
balrogadmin_1 |     super(Permissions, self).insert(changed_by=changed_by, transaction=transaction, **columns)
balrogadmin_1 |   File "./auslib/", line 325, in insert
balrogadmin_1 |     return self._prepareInsert(transaction, changed_by, **columns)
balrogadmin_1 |   File "./auslib/", line 301, in _prepareInsert
balrogadmin_1 |     ret = trans.execute(query)
balrogadmin_1 |   File "./auslib/", line 122, in execute
balrogadmin_1 |     return self.conn.execute(statement)
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/", line 1358, in execute
balrogadmin_1 |     params)
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/", line 1491, in _execute_clauseelement
balrogadmin_1 |     compiled_sql, distilled_params
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/", line 1599, in _execute_context
balrogadmin_1 |     context)
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/", line 1592, in _execute_context
balrogadmin_1 |     context)
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/", line 325, in do_execute
balrogadmin_1 |     cursor.execute(statement, parameters)
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/MySQLdb/", line 174, in execute
balrogadmin_1 |     self.errorhandler(self, exc, value)
balrogadmin_1 |   File "/usr/local/lib/python2.7/site-packages/MySQLdb/", 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
Attachment #8787285 - Flags: review?(rail)
Comment on attachment 8787285 [details] [review]
fix default value for options

Attachment #8787285 - Flags: review?(rail) → review+
Commit pushed to master at
bug 1297765: Use different default value for permission options. (#117). r=rail
Depends on: 1302450
This made it to production today.
Closed: 4 years ago
Resolution: --- → FIXED
I don't think this worked - I hit it again in stage today.
Resolution: FIXED → ---
Upon further investigation, it looks like this regressed when we switched to swagger/connexion.
Attachment #8920184 - Flags: review?(rail)
Priority: -- → P1
Attachment #8920184 - Flags: review?(rail) → review+
Depends on: 1411563
Closed: 4 years ago3 years ago
Resolution: --- → FIXED
Product: Release Engineering → Release Engineering Graveyard
You need to log in before you can comment on or make changes to this bug.