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
This commit is contained in:
parent
598b6bb528
commit
8bbf61f509
@ -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."""
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user