Пример #1
0
def main():
    # Pase config file and command line options, then start logging
    koala_service.prepare_service(sys.argv)

    # Build and start the WSGI app
    host = CONF.host
    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
Пример #2
0
def main():
    # Pase config file and command line options, then start logging
    koala_service.prepare_service(sys.argv)

    # Build and start the WSGI app
    host = CONF.host
    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
Пример #3
0
#
#         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.
"""Implementation of paginate query."""

import sqlalchemy

from koala.openstack.common.gettextutils import _
from koala.openstack.common import log as logging

LOG = logging.getLogger(__name__)


class InvalidSortKey(Exception):
    message = _("Sort key supplied was not valid.")


# copy from glance/db/sqlalchemy/api.py
def paginate_query(query,
                   model,
                   limit,
                   sort_keys,
                   marker=None,
                   sort_dir=None,
                   sort_dirs=None):
    """Returns a query with sorting / pagination criteria added.
Пример #4
0
#    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 koala.openstack.common.gettextutils import _
from koala.openstack.common import log as logging

from oslo.config import cfg

LOG = logging.getLogger(__name__)

exc_log_opts = [
    cfg.BoolOpt("fatal_exception_format_errors", default=False, help="make exception message format errors fatal")
]

CONF = cfg.CONF
CONF.register_opts(exc_log_opts)


class KoalaException(Exception):
    """Base Koala Exception

    To correctly use this class, inherit from it and define
    a 'message' property. That message will get printf'd
    with the keyword arguments provided to the constructor.