Avoid printing exception in db-setup

If the db-setup is run multiple times without dropping the database, the
attempt to set up version control again causes an exception. Since this is
an expected condition, just print a message and exit normally.

Signed-off-by: Zane Bitter <zbitter@redhat.com>
This commit is contained in:
Zane Bitter 2012-04-17 17:38:48 +02:00
parent f94547743e
commit d4fda02735
2 changed files with 7 additions and 3 deletions

View File

@ -221,7 +221,7 @@ else
pushd /usr/lib/python2.7/site-packages/heat-0.0.1-py2.7.egg/heat/db/sqlalchemy/
fi
python migrate_repo/manage.py version_control mysql://heat:heat@localhost/heat migrate_repo
python manage.py version_control
python manage.py upgrade
popd

View File

@ -1,6 +1,10 @@
#!/usr/bin/env python
from migrate.versioning.shell import main
import migrate.exceptions
if __name__ == '__main__':
main(url='mysql://heat:heat@localhost/heat', debug='False',
repository='migrate_repo')
try:
main(url='mysql://heat:heat@localhost/heat', debug='False',
repository='migrate_repo')
except migrate.exceptions.DatabaseAlreadyControlledError:
print 'Database already version controlled.'