~ubuntu-branches/ubuntu/saucy/heat/saucy

« back to all changes in this revision

Viewing changes to debian/patches/fix-sqlalchemy-0.8.patch

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short
  • Date: 2013-08-08 01:08:42 UTC
  • Revision ID: package-import@ubuntu.com-20130808010842-77cni2v4vlib7rus
Tags: 2013.2~b2-0ubuntu4
[ Chuck Short ]
* debian/rules: Enable testsuite during builds.
* debian/patches/fix-sqlalchemy-0.8.patch: Build against sqlalchemy 0.8.
* debian/patches/rename-quantumclient.patch: quantumclient -> neutronclient.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Fix heat db to work with sqlachmey 0.8.
 
2
Author: Chuck Short <zulcss@ubuntu.com>
 
3
Forwarded: No
 
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,
 
14
-                                                 unicode_error=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,
 
30
-                                                 unicode_error=None,
 
31
-                                                 _warn_on_bytestring=False))
 
32
+                               sqlalchemy.String(length=255))
 
33
     action.create(stack)
 
34
 
 
35
 
 
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()
 
49
 
 
50
 
 
51
-class Json(types.TypeDecorator, types.MutableType):
 
52
+class Json(types.TypeDecorator):
 
53
     impl = types.Text
 
54
 
 
55
     def process_bind_param(self, value, dialect):
 
56
@@ -42,6 +43,48 @@ class Json(types.TypeDecorator, types.Mu
 
57
         return loads(value)
 
58
 
 
59
 
 
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`.
 
64
+
 
65
+    .. versionadded in sqlalchemy:: 0.8
 
66
+
 
67
+    """
 
68
+
 
69
+    def __setitem__(self, key, value):
 
70
+        """Detect dictionary set events and emit change events."""
 
71
+        dict.__setitem__(self, key, value)
 
72
+        self.changed()
 
73
+
 
74
+    def __delitem__(self, key):
 
75
+        """Detect dictionary del events and emit change events."""
 
76
+        dict.__delitem__(self, key)
 
77
+        self.changed()
 
78
+
 
79
+    def clear(self):
 
80
+        dict.clear(self)
 
81
+        self.changed()
 
82
+
 
83
+    @classmethod
 
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)
 
90
+        else:
 
91
+            return value
 
92
+
 
93
+    def __getstate__(self):
 
94
+        return dict(self)
 
95
+
 
96
+    def __setstate__(self, state):
 
97
+        self.update(state)
 
98
+
 
99
+MutableDict.associate_with(Json)
 
100
+
 
101
+
 
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
 
110
 PasteDeploy==1.5.0
 
111
 routes==1.12.3
 
112
-SQLAlchemy>=0.7.8,<0.7.99
 
113
+SQLAlchemy>=0.7.8,<0.8.99
 
114
 WebOb==1.2.3
 
115
 python-keystoneclient>=0.2.1
 
116
 python-swiftclient>=1.2