diff options
author | Michael Still <mikal@stillhq.com> | 2015-02-20 06:28:21 +1100 |
---|---|---|
committer | Joshua Hesketh <josh@nitrotech.org> | 2015-02-24 11:56:08 +1100 |
commit | 8bbf61f5097dee459a4f05681e7f22a7e4e44ee2 (patch) | |
tree | 720bad8beecb8022a1f05fabdba5c98e6fdd4dbf /turbo_hipster | |
parent | 598b6bb528d53db1f91f5b9c05924fc7c0b0344a (diff) | |
download | turbo-hipster-8bbf61f5097dee459a4f05681e7f22a7e4e44ee2.tar.gz |
Handle the rename of the versions directory.
We still need to handle testing the API database as well at some
point, but for now just handle that there are two possible places
that the cell db could be.
Change-Id: I6f718d7037d7b01ccb772013ad367367a66f82e5
Closes-Bug: 1423662
Diffstat (limited to 'turbo_hipster')
-rw-r--r-- | turbo_hipster/task_plugins/real_db_upgrade/handle_results.py | 17 | ||||
-rwxr-xr-x | turbo_hipster/task_plugins/real_db_upgrade/nova_mysql_migrations.sh | 12 |
2 files changed, 24 insertions, 5 deletions
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 @@ class LogParser(object): 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 83893cc..28cf54b 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 @@ EOF 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 @@ EOF 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 |