Esempio n. 1
0
def main():
    service.prepare_service(sys.argv)

    # Build and start the WSGI app
    host = CONF.bind_ip
    port = CONF.port
    wsgi = simple_server.make_server(host, port,
                                     app.VersionSelectorApplication())

    LOG = log.getLogger(__name__)
    LOG.info("Serving on http://%s:%s" % (host, port))
    LOG.info("Configuration:")
    CONF.log_opt_values(LOG, logging.INFO)

    try:
        wsgi.serve_forever()
    except KeyboardInterrupt:
        pass
#    under the License.


import commands
import ConfigParser
import os
import urlparse

import sqlalchemy
import sqlalchemy.exc

from kds.openstack.common import lockutils
from kds.openstack.common import log as logging
from kds.openstack.common import test

LOG = logging.getLogger(__name__)


def _get_connect_string(backend, user, passwd, database):
    """Get database connection

    Try to get a connection with a very specific set of values, if we get
    these then we'll run the tests, otherwise they are skipped
    """
    if backend == "postgres":
        backend = "postgresql+psycopg2"
    elif backend == "mysql":
        backend = "mysql+mysqldb"
    else:
        raise Exception("Unrecognized backend: '%s'" % backend)