deb-heat/heat/db/sqlalchemy/manage.py
Dirk Mueller 234a1f0f2e Add missing Aapche 2.0 license headers (H102)
Satisfy Hacking check of Hacking 0.6 or newer.

Change-Id: I01d9b44c1681142ef91fd91f678e173239ae6c98
2013-07-19 23:10:25 +02:00

39 lines
1.5 KiB
Python
Executable File

#!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from migrate.versioning.shell import main
import migrate.exceptions
import ConfigParser
if __name__ == '__main__':
import os.path
migrate_repo_path = os.path.join(os.path.dirname(__file__),
'migrate_repo')
# Try to get the config-file value for sql_connection
# Note we can't use openstack.common.cfg because this also insists
# on parsing the CLI, which we don't want here
config = ConfigParser.SafeConfigParser()
try:
config = ConfigParser.SafeConfigParser()
config.readfp(open('/etc/heat/heat-engine.conf'))
sql_connection = config.get('DEFAULT', 'sql_connection')
except Exception:
sql_connection = 'mysql://heat:heat@localhost/heat'
try:
main(url=sql_connection, debug='False', repository=migrate_repo_path)
except migrate.exceptions.DatabaseAlreadyControlledError:
print('Database already version controlled.')