]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Avoid printing exception in db-setup
authorZane Bitter <zbitter@redhat.com>
Tue, 17 Apr 2012 15:38:48 +0000 (17:38 +0200)
committerZane Bitter <zbitter@redhat.com>
Tue, 17 Apr 2012 15:38:48 +0000 (17:38 +0200)
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>
bin/heat-db-setup-fedora
heat/db/sqlalchemy/manage.py

index 6153f5353bdf4a183ef9c3314f74d82f4287e473..00cb478586d8b1bdb1846f58c727c8df478d7521 100755 (executable)
@@ -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
 
index 489f24e9fa7e9e1a0af57d3d3831911fedabafab..4dffe78348eb2026616424146c841c44dd1e7cd7 100644 (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.'