Merge "Send results back on failure"
diff --git a/turbo_hipster/task_plugins/real_db_upgrade/handle_results.py b/turbo_hipster/task_plugins/real_db_upgrade/handle_results.py
index 561898f..4c02fb7 100644
--- a/turbo_hipster/task_plugins/real_db_upgrade/handle_results.py
+++ b/turbo_hipster/task_plugins/real_db_upgrade/handle_results.py
@@ -44,10 +44,21 @@
def find_schemas(self):
"""Return a list of the schema numbers present in git."""
+
+ # TODO(mikal): once more of the cells code lands this needs to handle
+ # the API migratons as well as the cells migration. Just do cells for
+ # now though.
+ cells_migration_path = os.path.join(
+ self.gitpath,
+ 'nova/db/sqlalchemy/cell_migrations/migrate_repo/versions')
+
+ if not os.path.exists(cells_migration_path):
+ cells_migration_path = os.path.join(
+ self.gitpath,
+ 'nova/db/sqlalchemy/migrate_repo/versions')
+
return [int(MIGRATION_NUMBER_RE.findall(f)[0]) for f in os.listdir(
- os.path.join(self.gitpath,
- 'nova/db/sqlalchemy/migrate_repo/versions'))
- if MIGRATION_NUMBER_RE.match(f)]
+ cells_migration_path) if MIGRATION_NUMBER_RE.match(f)]
def process_log(self):
"""Analyse a log for errors."""
diff --git a/turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh b/turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh
index b5ead37..e8f9b26 100755
--- a/turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh
+++ b/turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh
@@ -74,9 +74,17 @@
python setup.py -q develop
python setup.py -q install
+ # Find where we store db versions
+ # TODO(mikal): note this only handles the cell db for now
+ versions_path="$GIT_REPO_PATH/nova/db/sqlalchemy/cell_migrations/migrate_repo/versions"
+ if [ ! -e $versions_path ]
+ then
+ versions_path="$GIT_REPO_PATH/nova/db/sqlalchemy/migrate_repo/versions"
+ fi
+
# Log the migrations present
echo "Migrations present:"
- ls $GIT_REPO_PATH/nova/db/sqlalchemy/migrate_repo/versions/*.py | sed 's/.*\///' | egrep "^[0-9]+_"
+ ls $versions_path/*.py | sed 's/.*\///' | egrep "^[0-9]+_"
# Flush innodb's caches
echo "Restarting mysql"
@@ -90,7 +98,7 @@
if [ "%$2%" == "%%" ]
then
- end_version=`ls $GIT_REPO_PATH/nova/db/sqlalchemy/migrate_repo/versions/*.py | sed 's/.*\///' | egrep "^[0-9]+_" | tail -1 | cut -f 1 -d "_"`
+ end_version=`ls $versions_path/*.py | sed 's/.*\///' | egrep "^[0-9]+_" | tail -1 | cut -f 1 -d "_"`
else
end_version=$2
fi