indexer: catch another mysql exception

Mysql can also raise error 1412 when we change a resource type.

  oslo_db.exception.DBError: (pymysql.err.InternalError) (1412, u'Table
  definition has changed, please retry transaction')

This change catches it with a pymysql contants helper.

Change-Id: Ib20c9e05f9977af4c261432b35ec51be6670b0e3
This commit is contained in:
Mehdi Abaakouk 2017-01-23 14:49:30 +01:00
parent 417dd916a2
commit 2361401694
1 changed files with 3 additions and 2 deletions

View File

@ -1050,8 +1050,9 @@ class SQLAlchemyIndexer(indexer.IndexerDriver):
e, sqlalchemy.exc.ProgrammingError)
or not isinstance(
e.orig, pymysql.err.ProgrammingError)
or (e.orig.args[0]
!= pymysql.constants.ER.NO_SUCH_TABLE)):
or (e.orig.args[0] not in
[pymysql.constants.ER.NO_SUCH_TABLE,
pymysql.constants.ER.TABLE_DEF_CHANGED])):
raise
return all_resources