示例#1
0
# -*- coding: utf-8 -*-
#!/usr/bin/env python

import logging
import logging.config
import logging.handlers
import os

from cdsoss.common import cfg
from paste import deploy
from cdsoss.common.gettextutils import _
from cdsoss.version import version_info as version

paste_deploy_opts = [
    cfg.StrOpt('flavor',
               help=_('Partial name of a pipeline in your paste configuration '
                      'file with the service name removed.')),
    cfg.StrOpt('config_file', help=_('Name of the paste configuration file.')),
]

common_opts = [
    cfg.BoolOpt('enable_v1_api',
                default=True,
                help=_("Deploy the v1 OpenStack Logs API.")),
    cfg.StrOpt('pydev_worker_debug_host',
               default=None,
               help=_('The hostname/IP of the pydev process listening for '
                      'debug connections')),
    cfg.IntOpt('pydev_worker_debug_port',
               default=5678,
               help=_('The port on which a pydev process is listening for '
示例#2
0
# -*- coding: utf-8 -*-

import copy

from cdsoss.common import cfg

database_opts = [
    cfg.StrOpt('sqlite_db',
               deprecated_group='DEFAULT',
               default='cdsoss.sqlite',
               help='The file name to use with SQLite'),
    cfg.BoolOpt('sqlite_synchronous',
                deprecated_group='DEFAULT',
                default=True,
                help='If True, SQLite uses synchronous mode'),
    cfg.StrOpt('backend',
               default='sqlalchemy',
               deprecated_name='db_backend',
               deprecated_group='DEFAULT',
               help='The backend to use for db'),
    cfg.StrOpt('connection',
               default='mysql://*****:*****@10.131.32.1/cdsoss',
               help='The SQLAlchemy connection string used to connect to the '
               'database',
               secret=True,
               deprecated_opts=[
                   cfg.DeprecatedOpt('sql_connection', group='DEFAULT'),
                   cfg.DeprecatedOpt('sql_connection', group='DATABASE'),
                   cfg.DeprecatedOpt('connection', group='sql'),
               ]),
    cfg.StrOpt('mysql_sql_mode',
示例#3
0
from cdsoss.common import cfg
import routes
import routes.middleware
import webob.dec
import webob.exc
from webob import multidict

from cdsoss.common import exception
from cdsoss.common import utils
from cdsoss.common import gettextutils
from cdsoss.common import jsonutils
import cdsoss.common.log as logging

bind_opts = [
    cfg.StrOpt('bind_host',
               default='0.0.0.0',
               help=_('Address to bind the server.  Useful when '
                      'selecting a particular network interface.')),
    cfg.IntOpt('bind_port',
               default=8484,
               help=_('The port on which the server will listen.')),
]

socket_opts = [
    cfg.IntOpt('backlog',
               default=4096,
               help=_('The backlog value that will be used when creating the '
                      'TCP listener socket.')),
    cfg.IntOpt('tcp_keepidle',
               default=600,
               help=_('The value for the socket option TCP_KEEPIDLE.  This is '
                      'the time in seconds that the connection must be idle '
示例#4
0
from cdsoss.common import cfg

import cdsoss.api.policy
from cdsoss.common import exception
from cdsoss.common import log as logging
from cdsoss.common import policy

# NOTE(bourke): The default dict_type is collections.OrderedDict in py27, but
# we must set manually for compatibility with py26
CONFIG = ConfigParser.SafeConfigParser(dict_type=OrderedDict)
LOG = logging.getLogger(__name__)

property_opts = [
    cfg.StrOpt('property_protection_file',
               default=None,
               help=_('The location of the property protection file.')),
    cfg.StrOpt('property_protection_rule_format',
               default='roles',
               help=_('This config value indicates whether "roles" or '
                      '"policies" are used in the property protection file.')),
]

CONF = cfg.CONF
CONF.register_opts(property_opts)

# NOTE (spredzy): Due to the particularly lengthy name of the exception
# and the number of occurrence it is raise in this file, a variable is
# created
InvalidPropProtectConf = exception.InvalidPropertyProtectionConfiguration
示例#5
0
                default=False,
                help='Print debugging output (set logging level to '
                'DEBUG instead of default WARNING level).'),
    cfg.BoolOpt('verbose',
                short='v',
                default=False,
                help='Print more verbose output (set logging level to '
                'INFO instead of default WARNING level).'),
]

logging_cli_opts = [
    cfg.StrOpt('log-config-append',
               metavar='PATH',
               deprecated_name='log-config',
               help='The name of logging configuration file. It does not '
               'disable existing loggers, but just appends specified '
               'logging configuration to any other existing logging '
               'options. Please see the Python logging module '
               'documentation for details on logging configuration '
               'files.'),
    cfg.StrOpt('log-format',
               default=None,
               metavar='FORMAT',
               help='DEPRECATED. '
               'A logging.Formatter log message format string which may '
               'use any of the available logging.LogRecord attributes. '
               'This option is deprecated.  Please use '
               'logging_context_format_string and '
               'logging_default_format_string instead.'),
    cfg.StrOpt('log-date-format',
               default=_DEFAULT_LOG_DATE_FORMAT,
示例#6
0
import copy
import os.path

from cdsoss.common import cfg

from cdsoss.common import exception
from cdsoss.common import jsonutils
import cdsoss.common.log as logging
from cdsoss.common import policy

LOG = logging.getLogger(__name__)

policy_opts = [
    cfg.StrOpt('policy_file',
               default='policy.json',
               help=_('The location of the policy file.')),
    cfg.StrOpt('policy_default_rule',
               default='default',
               help=_('The default policy to use.')),
]

CONF = cfg.CONF
CONF.register_opts(policy_opts)

DEFAULT_RULES = {
    'context_is_admin': policy.RoleCheck('role', 'admin'),
    'default': policy.TrueCheck()
}

示例#7
0
from cdsoss.common import cfg

from cdsoss.common import fileutils
from cdsoss.common.gettextutils import _
from cdsoss.common import local
from cdsoss.common import log as logging


LOG = logging.getLogger(__name__)


util_opts = [
    cfg.BoolOpt('disable_process_locking', default=False,
                help='Whether to disable inter-process locks'),
    cfg.StrOpt('lock_path',
               default=os.environ.get("UNITELOG_LOCK_PATH"),
               help=('Directory to use for lock files.'))
]


CONF = cfg.CONF
CONF.register_opts(util_opts)


def set_defaults(lock_path):
    cfg.set_defaults(util_opts, lock_path=lock_path)


class _InterProcessLock(object):
    """Lock implementation which allows multiple locks, working around
    issues like bugs.debian.org/cgi-bin/bugreport.cgi?bug=632857 and does
示例#8
0
# -*- coding: utf-8 -*-

from cdsoss.common import cfg
import webob.exc

from cdsoss.api import policy
from cdsoss.common import wsgi
import cdsoss.context
from cdsoss.common import jsonutils
import cdsoss.common.log as logging

context_opts = [
    cfg.StrOpt('admin_role',
               default='admin',
               help=_('Role used to identify an authenticated user as '
                      'administrator.')),
    cfg.BoolOpt('allow_anonymous_access',
                default=False,
                help=_('Allow unauthenticated users to access the API with '
                       'read-only privileges. This only applies when using '
                       'ContextMiddleware.')),
]

CONF = cfg.CONF
CONF.register_opts(context_opts)

LOG = logging.getLogger(__name__)


class BaseContextMiddleware(wsgi.Middleware):
    def process_response(self, resp):