1
Description: Fix heat db to work with sqlachmey 0.8.
2
Author: Chuck Short <zulcss@ubuntu.com>
4
diff -Naurp heat-2013.2.b2.orig/heat/db/sqlalchemy/migrate_repo/versions/019_resource_action_status.py heat-2013.2.b2/heat/db/sqlalchemy/migrate_repo/versions/019_resource_action_status.py
5
--- heat-2013.2.b2.orig/heat/db/sqlalchemy/migrate_repo/versions/019_resource_action_status.py 2013-07-18 15:48:34.000000000 +0000
6
+++ heat-2013.2.b2/heat/db/sqlalchemy/migrate_repo/versions/019_resource_action_status.py 2013-08-07 19:47:05.291156844 +0000
7
@@ -22,11 +22,7 @@ def upgrade(migrate_engine):
8
# Align the current state/state_description with the
9
# action/status now used in the event table
10
action = sqlalchemy.Column('action',
11
- sqlalchemy.String(length=255,
12
- convert_unicode=False,
13
- assert_unicode=None,
15
- _warn_on_bytestring=False))
16
+ sqlalchemy.String(length=255))
17
action.create(resource)
18
resource.c.state.alter(name='status')
19
resource.c.state_description.alter(name='status_reason')
20
diff -Naurp heat-2013.2.b2.orig/heat/db/sqlalchemy/migrate_repo/versions/020_stack_action.py heat-2013.2.b2/heat/db/sqlalchemy/migrate_repo/versions/020_stack_action.py
21
--- heat-2013.2.b2.orig/heat/db/sqlalchemy/migrate_repo/versions/020_stack_action.py 2013-07-18 15:48:34.000000000 +0000
22
+++ heat-2013.2.b2/heat/db/sqlalchemy/migrate_repo/versions/020_stack_action.py 2013-08-07 19:47:30.935156844 +0000
23
@@ -21,11 +21,7 @@ def upgrade(migrate_engine):
24
stack = sqlalchemy.Table('stack', meta, autoload=True)
25
# Align with action/status now used in the event/resource tables
26
action = sqlalchemy.Column('action',
27
- sqlalchemy.String(length=255,
28
- convert_unicode=False,
29
- assert_unicode=None,
31
- _warn_on_bytestring=False))
32
+ sqlalchemy.String(length=255))
36
diff -Naurp heat-2013.2.b2.orig/heat/db/sqlalchemy/models.py heat-2013.2.b2/heat/db/sqlalchemy/models.py
37
--- heat-2013.2.b2.orig/heat/db/sqlalchemy/models.py 2013-07-18 15:48:34.000000000 +0000
38
+++ heat-2013.2.b2/heat/db/sqlalchemy/models.py 2013-08-07 19:46:17.583156844 +0000
39
@@ -20,6 +20,7 @@ import sqlalchemy
40
from sqlalchemy.orm import relationship, backref, object_mapper
41
from sqlalchemy.exc import IntegrityError
42
from sqlalchemy.ext.declarative import declarative_base
43
+from sqlalchemy.ext.mutable import Mutable
44
from sqlalchemy import types
45
from json import dumps
46
from json import loads
47
@@ -32,7 +33,7 @@ from sqlalchemy.orm.session import Sessi
48
BASE = declarative_base()
51
-class Json(types.TypeDecorator, types.MutableType):
52
+class Json(types.TypeDecorator):
55
def process_bind_param(self, value, dialect):
56
@@ -42,6 +43,48 @@ class Json(types.TypeDecorator, types.Mu
60
+#This class already in sqlalchemy 0.8 but not in 0.7
61
+#Add it here for integration
62
+class MutableDict(Mutable, dict):
63
+ """A dictionary type that implements :class:`.Mutable`.
65
+ .. versionadded in sqlalchemy:: 0.8
69
+ def __setitem__(self, key, value):
70
+ """Detect dictionary set events and emit change events."""
71
+ dict.__setitem__(self, key, value)
74
+ def __delitem__(self, key):
75
+ """Detect dictionary del events and emit change events."""
76
+ dict.__delitem__(self, key)
84
+ def coerce(cls, key, value):
85
+ """Convert plain dictionary to MutableDict."""
86
+ if not isinstance(value, MutableDict):
87
+ if isinstance(value, dict):
88
+ return MutableDict(value)
89
+ return Mutable.coerce(key, value)
93
+ def __getstate__(self):
96
+ def __setstate__(self, state):
99
+MutableDict.associate_with(Json)
102
class HeatBase(object):
103
"""Base class for Heat Models."""
104
__table_args__ = {'mysql_engine': 'InnoDB'}
105
diff -Naurp heat-2013.2.b2.orig/requirements.txt heat-2013.2.b2/requirements.txt
106
--- heat-2013.2.b2.orig/requirements.txt 2013-07-18 15:48:34.000000000 +0000
107
+++ heat-2013.2.b2/requirements.txt 2013-08-07 19:47:41.343156844 +0000
108
@@ -14,7 +14,7 @@ sqlalchemy-migrate>=0.7.2
109
python-novaclient>=2.12.0
112
-SQLAlchemy>=0.7.8,<0.7.99
113
+SQLAlchemy>=0.7.8,<0.8.99
115
python-keystoneclient>=0.2.1
116
python-swiftclient>=1.2