Since versions of heat can and will change, we do not want want them
hard-coded in the DB setup script. Instead, use the Python import logic to
determine the location of the module.
This will use the local copy of heat (which is usually what you want) if
run from the top level of the repository. Otherwise it will use the
installed version, as determined by Python.
Signed-off-by: Zane Bitter <zbitter@redhat.com>
sed -i -e "s/mysql:\/\/heat:\(.*\)@/mysql:\/\/heat:${MYSQL_HEAT_PW}@/" ${HEAT_CONFIG}
fi
-# Create the schema using sqlalchemy-migrate
-if [ "$1" = "rpm" ]
-then
- pushd /usr/lib/python2.7/site-packages/heat/db/sqlalchemy
-else
- pushd /usr/lib/python2.7/site-packages/heat-0.0.1-py2.7.egg/heat/db/sqlalchemy/
-fi
-
-python manage.py version_control
-python manage.py upgrade
-popd
+python -m heat.db.sqlalchemy.manage version_control
+python -m heat.db.sqlalchemy.manage upgrade
# Do a final sanity check on the database.
import migrate.exceptions
if __name__ == '__main__':
+ import os.path
+ migrate_repo_path = os.path.join(os.path.dirname(__file__),
+ 'migrate_repo')
+
try:
main(url='mysql://heat:heat@localhost/heat', debug='False',
- repository='migrate_repo')
+ repository=migrate_repo_path)
except migrate.exceptions.DatabaseAlreadyControlledError:
print 'Database already version controlled.'