~ubuntu-branches/ubuntu/trusty/heat/trusty

« back to all changes in this revision

Viewing changes to .pc/fix-sqlalchemy-0.8.patch/heat/db/sqlalchemy/migrate_repo/versions/019_resource_action_status.py

  • 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
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 
2
 
 
3
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
4
#    not use this file except in compliance with the License. You may obtain
 
5
#    a copy of the License at
 
6
#
 
7
#         http://www.apache.org/licenses/LICENSE-2.0
 
8
#
 
9
#    Unless required by applicable law or agreed to in writing, software
 
10
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
11
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
12
#    License for the specific language governing permissions and limitations
 
13
#    under the License.
 
14
 
 
15
import sqlalchemy
 
16
 
 
17
 
 
18
def upgrade(migrate_engine):
 
19
    meta = sqlalchemy.MetaData(bind=migrate_engine)
 
20
 
 
21
    resource = sqlalchemy.Table('resource', meta, autoload=True)
 
22
    # Align the current state/state_description with the
 
23
    # action/status now used in the event table
 
24
    action = sqlalchemy.Column('action',
 
25
                               sqlalchemy.String(length=255,
 
26
                                                 convert_unicode=False,
 
27
                                                 assert_unicode=None,
 
28
                                                 unicode_error=None,
 
29
                                                 _warn_on_bytestring=False))
 
30
    action.create(resource)
 
31
    resource.c.state.alter(name='status')
 
32
    resource.c.state_description.alter(name='status_reason')
 
33
 
 
34
 
 
35
def downgrade(migrate_engine):
 
36
    meta = sqlalchemy.MetaData(bind=migrate_engine)
 
37
 
 
38
    resource = sqlalchemy.Table('resource', meta, autoload=True)
 
39
    resource.c.status.drop()
 
40
    resource.c.status.alter(name='state')
 
41
    resource.c.status_reason.alter(name='state_description')