# HG changeset patch # User Drew Fisher # Date 1397142347 21600 # Node ID 8df87d621cea0da4baa2f15e5da9286662d461d2 # Parent f3a6bd7bd4a68d638d70d3c12cc54e300e2a566c 18551500 keystone's SMF method shouldn't try to enable mysql diff -r f3a6bd7bd4a6 -r 8df87d621cea components/openstack/keystone/files/keystone --- a/components/openstack/keystone/files/keystone Thu Apr 10 08:52:58 2014 -0600 +++ b/components/openstack/keystone/files/keystone Thu Apr 10 09:05:47 2014 -0600 @@ -14,21 +14,16 @@ # License for the specific language governing permissions and limitations # under the License. -import ConfigParser import os import sys import smf_include -from subprocess import CalledProcessError, check_call, PIPE, Popen - -from sqlalchemy import create_engine +from subprocess import CalledProcessError, check_call -def db_sync(): - """ function to create the database schema - """ - +def start(): + # sync the database to make sure it's ready cmd = ["/usr/bin/keystone-manage", "db_sync"] try: check_call(cmd) @@ -36,47 +31,6 @@ print "Unable to create database for Keystone: %s" % err sys.exit(smf_include.SMF_EXIT_ERR_CONFIG) - -def start(): - # read the options from the config file - parser = ConfigParser.ConfigParser() - parser.read("/etc/keystone/keystone.conf") - - # get the database type - db_engine = create_engine(parser.get("sql", "connection")) - db_type = db_engine.name - - if db_type == "sqlite": - # look to see if file exists or if it's zero length - abspath = os.path.abspath(db_engine.url.database) - if not os.path.exists(abspath) or os.path.getsize(abspath) == 0: - db_sync() - - elif db_type == "mysql": - mysql_svc = "svc:/application/database/mysql:version_55" - cmd = ["/usr/bin/svcs", "-H", "-o", "state", mysql_svc] - - try: - p = Popen(cmd, stdout=PIPE, stderr=PIPE) - output, error = p.communicate() - except CalledProcessError: - print "mysql service not found. Is it installed?" - return smf_include.SMF_EXIT_ERR_CONFIG - - if output.strip() != "online": - # attempt to start mysql - cmd = ["/usr/sbin/svcadm", "enable", "-rs", mysql_svc] - - try: - check_call(cmd) - except CalledProcessError as err: - print "starting mysql service failed: %s" % err - return smf_include.SMF_EXIT_ERR_CONFIG - - # not sure how to check if the database is valid, so just create - # the database every time for now - db_sync() - smf_include.smf_subprocess("/usr/lib/keystone/keystone-all") if __name__ == "__main__":