Added SQLA 0.9 patch.
authorThomas Goirand <thomas@goirand.fr>
Thu, 13 Mar 2014 16:35:46 +0000 (00:35 +0800)
committerThomas Goirand <thomas@goirand.fr>
Thu, 13 Mar 2014 16:35:46 +0000 (00:35 +0800)
Change-Id: If03b99ed2cf0422298f8e318abe1860285b6a3df

Rewritten-From: 5b6c693dc6e4a634f8a1a2cbc55a4e64ade3d0a3

trusty/debian/patches/Make_ceilometer_work_with_sqla_0.9.x.patch [new file with mode: 0644]
trusty/debian/patches/series

diff --git a/trusty/debian/patches/Make_ceilometer_work_with_sqla_0.9.x.patch b/trusty/debian/patches/Make_ceilometer_work_with_sqla_0.9.x.patch
new file mode 100644 (file)
index 0000000..4f115f2
--- /dev/null
@@ -0,0 +1,44 @@
+Description: Make ceilometer work with sqla 0.9.x
+ Ceilometer's migration 028 makes some very specific assumptions about sqla
+ data structures and exception paths, which are not true in sqla 0.9.x. In 0.8
+ you were shielded from errors on drop by sqla, but in 0.9 you get raw
+ exceptions from the db layer thrown all the way up, which causes a failure
+ condition when trying to delete the non existent alembic table.
+ .
+ We can get basically the same behavior as before by using the checkfirst=True
+ parameter on table definitions. This will actually ensure that we get the
+ table in question, and get the NoSuchTableError when we expect it.
+Author: Sean Dague <sean.dague@samsung.com>
+Date: Mon, 10 Mar 2014 22:06:32 +0000 (-0400)
+X-Git-Url: https://review.openstack.org/gitweb?p=openstack%2Fceilometer.git;a=commitdiff_plain;h=63f6d6af77d5fe7227b074ddc3e1594a424873e6
+Origin: upstream, https://review.openstack.org/#/c/79482/
+Change-Id: Ida33a3030fb03c2f3eeed9f129fcc0063a7b7c4b
+
+diff --git a/ceilometer/storage/sqlalchemy/migrate_repo/versions/028_alembic_migrations.py b/ceilometer/storage/sqlalchemy/migrate_repo/versions/028_alembic_migrations.py
+index b527692..567620c 100644
+--- a/ceilometer/storage/sqlalchemy/migrate_repo/versions/028_alembic_migrations.py
++++ b/ceilometer/storage/sqlalchemy/migrate_repo/versions/028_alembic_migrations.py
+@@ -21,7 +21,10 @@ import sqlalchemy as sa
+ def get_alembic_version(meta):
+     """Return Alembic version or None if no Alembic table exists."""
+     try:
+-        a_ver = sa.Table('alembic_version', meta, autoload=True)
++        a_ver = sa.Table(
++            'alembic_version',
++            meta,
++            autoload=True)
+         return sa.select([a_ver.c.version_num]).scalar()
+     except sa.exc.NoSuchTableError:
+         return None
+@@ -29,7 +32,10 @@ def get_alembic_version(meta):
+ def delete_alembic(meta):
+     try:
+-        sa.Table('alembic_version', meta, autoload=True).drop()
++        sa.Table(
++            'alembic_version',
++            meta,
++            autoload=True).drop(checkfirst=True)
+     except sa.exc.NoSuchTableError:
+         pass
index 970683ff9a422ddce3d54440b4b43a75a48ac94f..37f31974cf60cf5e3a7ef8d66964fa0fce60430c 100644 (file)
@@ -1 +1,2 @@
 removes-sqla0.8-restrictions.patch
+Make_ceilometer_work_with_sqla_0.9.x.patch