Ticket #335 (closed defect: fixed)
Adding a table to msc database breaks plugin loading / scheduler
| Reported by: | nnoirbent | Owned by: | oroussy |
|---|---|---|---|
| Priority: | Normal | Milestone: | 1.2.1 |
| Component: | python-mmc-msc | Version: | 1.1.0 |
| Severity: | Major | Keywords: | |
| Cc: |
Description
Unfortunately, the MscDatabase?.db_check() method is not called before MscDatabase?.initTables(), which fails if the database is not up to date with respect to the SQLAlchemy code (SQLAlchemy raises an error when it doesn't find the database relationships it expects).
This triggers this kind of tracebacks when looking at the mmc-agent logs / launching pulse2-scheduler manually :
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/mmc/agent.py", line 405, in agentService
if (func()):
File "/usr/lib/python2.3/site-packages/mmc/plugins/msc/__init__.py", line 78, in activate
MscDatabase().activate()
File "/usr/lib/python2.3/site-packages/mmc/plugins/msc/database.py", line 130, in activate
self.initTables()
File "/usr/lib/python2.3/site-packages/mmc/plugins/msc/database.py", line 184, in initTables
autoload = True
File "/usr/lib/python2.3/site-packages/sqlalchemy/schema.py", line 175, in __call__
metadata._get_engine(raiseerr=True).reflecttable(table)
File "/usr/lib/python2.3/site-packages/sqlalchemy/engine/base.py", line 806, in reflecttable
self.dialect.reflecttable(conn, table)
File "/usr/lib/python2.3/site-packages/sqlalchemy/databases/mysql.py", line 1109, in reflecttable
raise exceptions.NoSuchTableError(table.fullname)
NoSuchTableError: bundle
The most obvious fix for this would be to call db_check() before calling initTables() in MscDatabase?.activate(), which would in turn entail adding a return value to activate() and checking for this value where it is called.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

