Catch sqlalchemy.exc.InvalidRequestError exception

Running update of keystone produces the following exception which
teminates processing. This enables processing to continue, like
capture of other types of errors.
* Table 'federation_protocol' is already defined for this MetaData
  instance.  Specify 'extend_existing=True' to redefine options and
  columns on an existing Table object.

Cater for projects that do not use sqlalchemy, e.g. swift.

Change-Id: I87df4bb784f94b7194374b2448e4c34beadb923f
This commit is contained in:
Ronald Bradford 2016-03-16 15:43:53 -04:00
parent 0c4e6e2e36
commit 4bca964706
1 changed files with 9 additions and 0 deletions

View File

@ -30,6 +30,11 @@ import sys
import jinja2
import stevedore
try:
from sqlalchemy import exc
except Exception:
pass
sys.path.insert(0, '.')
from hooks import HOOKS # noqa
@ -108,6 +113,10 @@ def import_modules(repo_location, package_name, verbose=0):
if verbose >= 2:
print(e)
continue
except exc.InvalidRequestError as e:
if verbose >= 2:
print(e)
continue
except Exception as e:
print("Impossible to import module %s" % modname)
raise e