Skip to content

Commit

Permalink
[FIX] runbot: prevent crash with invalid exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Williambraecky committed Nov 18, 2024
1 parent c2e9aaf commit 400448d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion runbot/models/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def _compute_message(self):
exception.message = message_layout.format(exception=exception, base_url=exception.get_base_url())

def _generate(self):
exceptions = self.search([])
exceptions = self.search([('elements', '!=', False)])
if exceptions:
return 'suppress_upgrade_warnings=%s' % (','.join(exceptions.mapped('elements'))).replace(' ', '').replace('\n', ',')
return False
Expand Down
3 changes: 3 additions & 0 deletions runbot/tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,3 +575,6 @@ def test_exceptions_in_env(self):
self.env['runbot.upgrade.exception'].create({'elements': 'field:module.some_field2'})
env_var = self.env['runbot.upgrade.exception']._generate()
self.assertEqual(env_var, 'suppress_upgrade_warnings=field:module.some_field,view:some_view_xmlid,field:module.some_field2')
self.env['runbot.upgrade.exception'].create({})
env_var = self.env['runbot.upgrade.exception']._generate()
self.assertEqual(env_var, 'suppress_upgrade_warnings=field:module.some_field,view:some_view_xmlid,field:module.some_field2')

0 comments on commit 400448d

Please sign in to comment.