18
18
Index: glance/glance/registry/db/api.py
19
19
===================================================================
20
--- glance.orig/glance/registry/db/api.py 2012-04-06 14:36:59.876739784 -0700
21
+++ glance/glance/registry/db/api.py 2012-04-06 14:37:01.372739856 -0700
20
--- glance.orig/glance/registry/db/api.py 2012-04-12 12:26:21.294886517 -0700
21
+++ glance/glance/registry/db/api.py 2012-04-12 12:26:24.654886685 -0700
87
87
def check_mutate_authorization(context, image_ref):
88
88
Index: glance/run_tests.py
89
89
===================================================================
90
--- glance.orig/run_tests.py 2012-04-06 14:36:33.030620000 -0700
91
+++ glance/run_tests.py 2012-04-06 14:37:58.972742603 -0700
90
--- glance.orig/run_tests.py 2012-04-12 12:26:21.310886517 -0700
91
+++ glance/run_tests.py 2012-04-12 12:26:24.654886685 -0700
92
92
@@ -284,6 +284,10 @@
93
93
logger.addHandler(hdlr)
94
94
logger.setLevel(logging.DEBUG)
100
100
c = config.Config(stream=sys.stdout,
103
Index: glance/glance/registry/db/migration.py
104
===================================================================
105
--- glance.orig/glance/registry/db/migration.py 2012-04-12 12:26:21.278886515 -0700
106
+++ glance/glance/registry/db/migration.py 2012-04-12 12:26:24.654886685 -0700
107
@@ -119,14 +119,25 @@
108
:retval version number
110
sql_connection = conf.sql_connection
111
+ repo_path = get_migrate_repo_path()
112
+ latest = versioning_repository.Repository(repo_path).latest
114
+ version = version or latest
117
- _version_control(conf, current_version)
118
- except versioning_exceptions.DatabaseAlreadyControlledError, e:
119
- if current_version is not None:
120
- msg = (_("database '%(sql_connection)s' is already under "
121
- "migration control") % locals())
122
- raise exception.DatabaseMigrationError(msg)
123
+ # Attempt to get migration_repo version. Should succeed
124
+ # if db was created under version control.
126
+ except exception.DatabaseMigrationError:
127
+ # If it was not created under VC, do nothing until user puts it
128
+ # under VC and sets appropriate version.
129
+ msg = (_("Database '%(sql_connection)s' does not appear to be under "
130
+ "version control. Refusing to migrate. You can enable "
131
+ "version control for by using 'glance-manage version_control "
132
+ " [VERSION #]") % locals())
133
+ raise exception.DatabaseMigrationError(msg)
135
+ # Migrate to the latest
136
upgrade(conf, version=version)