short='d', 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', metavar='PATH', help='If this option is specified, the logging configuration ' 'file specified is used and overrides any other logging ' 'options specified. Please see the Python logging module ' 'documentation for details on logging configuration ' 'files.'), cfg.StrOpt('log-format', default=_DEFAULT_LOG_FORMAT, metavar='FORMAT', help='A logging.Formatter log message format string which may ' 'use any of the available logging.LogRecord attributes. ' 'Default: %(default)s'), cfg.StrOpt('log-date-format', default=_DEFAULT_LOG_DATE_FORMAT, metavar='DATE_FORMAT', help='Format string for %%(asctime)s in log records. ' 'Default: %(default)s'), cfg.StrOpt('log-file',
import logging.handlers import os import stat import sys import traceback from moniker.openstack.common import cfg from moniker.openstack.common.gettextutils import _ from moniker.openstack.common import jsonutils from moniker.openstack.common import local from moniker.openstack.common import notifier log_opts = [ cfg.StrOpt('logging_context_format_string', default='%(asctime)s %(levelname)s %(name)s [%(request_id)s ' '%(user_id)s %(project_id)s] %(instance)s' '%(message)s', help='format string to use for log messages with context'), cfg.StrOpt('logging_default_format_string', default='%(asctime)s %(process)d %(levelname)s %(name)s [-]' ' %(instance)s%(message)s', help='format string to use for log messages without context'), cfg.StrOpt('logging_debug_format_suffix', default='%(funcName)s %(pathname)s:%(lineno)d', help='data to append to log format when level is DEBUG'), cfg.StrOpt('logging_exception_prefix', default='%(asctime)s %(process)d TRACE %(name)s %(instance)s', help='prefix each line of exception output with this format'), cfg.ListOpt('default_log_levels', default=[ 'amqplib=WARN', 'sqlalchemy=WARN', 'boto=WARN',
# License for the specific language governing permissions and limitations # under the License. """ A remote procedure call (rpc) abstraction. For some wrappers that add message versioning to rpc, see: rpc.dispatcher rpc.proxy """ from moniker.openstack.common import cfg from moniker.openstack.common import importutils rpc_opts = [ cfg.StrOpt('rpc_backend', default='%s.impl_kombu' % __package__, help="The messaging module to use, defaults to kombu."), cfg.IntOpt('rpc_thread_pool_size', default=64, help='Size of RPC thread pool'), cfg.IntOpt('rpc_conn_pool_size', default=30, help='Size of RPC connection pool'), cfg.IntOpt('rpc_response_timeout', default=60, help='Seconds to wait for a response from call or multicall'), cfg.IntOpt('rpc_cast_timeout', default=30, help='Seconds to wait before a cast expires (TTL). ' 'Only supported by impl_zmq.'), cfg.ListOpt('allowed_rpc_exception_modules',
# 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. import os import socket from moniker.openstack.common import cfg from moniker.openstack.common import rpc cfg.CONF.register_opts([ cfg.StrOpt('host', default=socket.gethostname(), help='Name of this node'), cfg.StrOpt('pybasedir', default=os.path.abspath(os.path.join(os.path.dirname(__file__), '../')), help='Directory where the nova python module is installed'), cfg.StrOpt('state-path', default='$pybasedir', help='Top-level directory for maintaining moniker\'s state'), cfg.StrOpt('central-topic', default='central', help='Central Topic'), cfg.StrOpt('agent-topic', default='agent', help='Agent Topic'), ]) rpc.set_defaults(control_exchange='moniker')
return keys for direct exchanges, per (approximate) AMQP parlance. """ import contextlib import itertools import json import logging from moniker.openstack.common import cfg from moniker.openstack.common.gettextutils import _ matchmaker_opts = [ # Matchmaker ring file cfg.StrOpt('matchmaker_ringfile', default='/etc/nova/matchmaker_ring.json', help='Matchmaker ring file (JSON)'), ] CONF = cfg.CONF CONF.register_opts(matchmaker_opts) LOG = logging.getLogger(__name__) contextmanager = contextlib.contextmanager class MatchMakerException(Exception): """Signified a match could not be found.""" message = _("Match not found by MatchMaker.") class Exchange(object):
# 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 moniker.openstack.common import cfg from moniker.openstack.common import log as logging from moniker.notification_handler.base import BaseAddressHandler LOG = logging.getLogger(__name__) cfg.CONF.register_group( cfg.OptGroup(name='handler:quantum_floatingip', title="Configuration for Quantum Notification Handler")) cfg.CONF.register_opts([ cfg.ListOpt('notification-topics', default=['monitor']), cfg.StrOpt('control-exchange', default='quantum'), cfg.StrOpt('domain-id', default=None), cfg.StrOpt('format', default=None) ], group='handler:quantum_floatingip') class QuantumFloatingHandler(BaseAddressHandler): """ Handler for Quantum's notifications """ __plugin_name__ = 'quantum_floatingip' def get_exchange_topics(self): exchange = cfg.CONF[self.name].control_exchange topics = [ topic + ".info"
from moniker.openstack.common.gettextutils import _ from moniker.openstack.common import importutils from moniker.openstack.common import jsonutils from moniker.openstack.common import log as logging from moniker.openstack.common import timeutils LOG = logging.getLogger(__name__) notifier_opts = [ cfg.MultiStrOpt('notification_driver', default=[], deprecated_name='list_notifier_drivers', help='Driver or drivers to handle sending notifications'), cfg.StrOpt('default_notification_level', default='INFO', help='Default notification level for outgoing notifications'), cfg.StrOpt('default_publisher_id', default='$host', help='Default publisher_id for outgoing notifications'), ] CONF = cfg.CONF CONF.register_opts(notifier_opts) WARN = 'WARN' INFO = 'INFO' ERROR = 'ERROR' CRITICAL = 'CRITICAL' DEBUG = 'DEBUG'
# # 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. import flask from moniker.openstack.common import cfg from moniker.openstack.common import jsonutils cfg.CONF.register_opts([ cfg.StrOpt('api_host', default='0.0.0.0', help='API Host'), cfg.IntOpt('api_port', default=9001, help='API Port Number'), cfg.StrOpt('api_paste_config', default='moniker-api-paste.ini', help='File name for the paste.deploy config for moniker-api'), cfg.StrOpt('auth_strategy', default='noauth', help='The strategy to use for auth. Supports noauth or ' 'keystone'), ]) # Allows us to serialize datetime's etc flask.helpers.json = jsonutils
from moniker.openstack.common import cfg from moniker.openstack.common import log as logging from moniker import utils from moniker.backend import base from sqlalchemy.ext.sqlsoup import SqlSoup from sqlalchemy.engine.url import _parse_rfc1738_args from moniker.sqlalchemy.session import get_engine, SQLOPTS LOG = logging.getLogger(__name__) cfg.CONF.register_group(cfg.OptGroup( name='backend:mysqlbind9', title="Configuration for BIND9+MySQL Backend" )) cfg.CONF.register_opts([ cfg.StrOpt('rndc-host', default='127.0.0.1', help='RNDC Host'), cfg.IntOpt('rndc-port', default=953, help='RNDC Port'), cfg.StrOpt('rndc-config-file', default=None, help='RNDC Config File'), cfg.StrOpt('rndc-key-file', default=None, help='RNDC Key File'), cfg.StrOpt('dns-server-type', default='master', help='slave or master DNS server?'), cfg.BoolOpt('write-database', default=True, help='Write to the DNS mysqlbind database?'), cfg.StrOpt('database-dns-table', default='dns_domains', help='DNS schema'), ], group='backend:mysqlbind9') cfg.CONF.register_opts(SQLOPTS, group='backend:mysqlbind9')
# # 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 moniker.openstack.common import cfg from moniker.openstack.common import log as logging from moniker.quota.base import Quota LOG = logging.getLogger(__name__) cfg.CONF.register_opts([ cfg.IntOpt('quota-domains', default=10, help='Number of domains allowed ' 'per tenant'), cfg.StrOpt('quota-domain-records', default=500, help='Number of records ' 'allowed per domain'), ]) def get_quota(): quota_driver = cfg.CONF['service:central'].quota_driver return Quota.get_plugin(quota_driver, invoke_on_load=True)
# 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 urlparse import urlparse from stevedore import driver from moniker.openstack.common import cfg from moniker.openstack.common import log as logging LOG = logging.getLogger(__name__) DRIVER_NAMESPACE = 'moniker.storage' cfg.CONF.register_opts([ cfg.StrOpt('database_connection', default='sqlite:///$state_path/moniker.sqlite', help='The database driver to use') ]) def register_opts(conf): engine = get_engine(conf) engine.register_opts(conf) def get_engine(conf): engine_name = urlparse(conf.database_connection).scheme LOG.debug('looking for %r engine in %r', engine_name, DRIVER_NAMESPACE) mgr = driver.DriverManager( DRIVER_NAMESPACE, engine_name,
import eventlet import greenlet import qpid.messaging import qpid.messaging.exceptions from moniker.openstack.common import cfg from moniker.openstack.common.gettextutils import _ from moniker.openstack.common import jsonutils from moniker.openstack.common.rpc import amqp as rpc_amqp from moniker.openstack.common.rpc import common as rpc_common LOG = logging.getLogger(__name__) qpid_opts = [ cfg.StrOpt('qpid_hostname', default='localhost', help='Qpid broker hostname'), cfg.StrOpt('qpid_port', default='5672', help='Qpid broker port'), cfg.StrOpt('qpid_username', default='', help='Username for qpid connection'), cfg.StrOpt('qpid_password', default='', help='Password for qpid connection'), cfg.StrOpt('qpid_sasl_mechanisms', default='', help='Space separated list of SASL mechanisms to use for auth'), cfg.BoolOpt('qpid_reconnect', default=True,
# License for the specific language governing permissions and limitations # under the License. import os from moniker.openstack.common import cfg from moniker.openstack.common import log as logging from moniker import utils from moniker.backend import base LOG = logging.getLogger(__name__) cfg.CONF.register_group( cfg.OptGroup(name='backend:bind9', title="Configuration for BIND9 Backend")) cfg.CONF.register_opts([ cfg.StrOpt('rndc-host', default='127.0.0.1', help='RNDC Host'), cfg.IntOpt('rndc-port', default=953, help='RNDC Port'), cfg.StrOpt('rndc-config-file', default=None, help='RNDC Config File'), cfg.StrOpt('rndc-key-file', default=None, help='RNDC Key File'), ], group='backend:bind9') class Bind9Backend(base.Backend): __plugin_name__ = 'bind9' def start(self): super(Bind9Backend, self).start() # TODO: This is a hack to ensure the data dir is 100% up to date domains = self.central_service.get_domains(self.admin_context)
# License for the specific language governing permissions and limitations # under the License. """ A remote procedure call (rpc) abstraction. For some wrappers that add message versioning to rpc, see: rpc.dispatcher rpc.proxy """ from moniker.openstack.common import cfg from moniker.openstack.common import importutils rpc_opts = [ cfg.StrOpt('rpc_backend', default='%s.impl_kombu' % __package__, help="The messaging module to use, defaults to kombu."), cfg.IntOpt('rpc_thread_pool_size', default=64, help='Size of RPC thread pool'), cfg.IntOpt('rpc_conn_pool_size', default=30, help='Size of RPC connection pool'), cfg.IntOpt('rpc_response_timeout', default=60, help='Seconds to wait for a response from call or multicall'), cfg.IntOpt('rpc_cast_timeout', default=30, help='Seconds to wait before a cast expires (TTL). ' 'Only supported by impl_zmq.'), cfg.ListOpt('allowed_rpc_exception_modules',
from moniker.openstack.common import log as logging from moniker import exceptions from moniker.backend import base from moniker.backend.impl_powerdns import models from moniker.sqlalchemy.session import get_session, SQLOPTS from moniker.sqlalchemy.expressions import InsertFromSelect LOG = logging.getLogger(__name__) TSIG_SUPPORTED_ALGORITHMS = ['hmac-md5'] cfg.CONF.register_group( cfg.OptGroup(name='backend:powerdns', title="Configuration for Powerdns Backend")) cfg.CONF.register_opts([ cfg.StrOpt('domain-type', default='NATIVE', help='PowerDNS Domain Type'), cfg.ListOpt('also-notify', default=[], help='List of additional IPs to ' 'send NOTIFYs to'), ] + SQLOPTS, group='backend:powerdns') class PowerDNSBackend(base.Backend): __plugin_name__ = 'powerdns' def start(self): super(PowerDNSBackend, self).start() self.session = get_session(self.name)
# # 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 moniker.openstack.common import cfg from moniker.openstack.common import log as logging from moniker.openstack.common import policy from moniker import utils from moniker import exceptions LOG = logging.getLogger(__name__) cfg.CONF.register_opts([ cfg.StrOpt('policy-file', default='policy.json'), cfg.StrOpt('policy-default-rule', default='default'), ]) def init_policy(): LOG.info('Initializing Policy') with open(utils.find_config(cfg.CONF.policy_file)) as fh: policy_json = fh.read() rules = policy.Rules.load_json(policy_json, cfg.CONF.policy_default_rule) policy.set_rules(rules) def check(rule, ctxt, target={}, exc=exceptions.Forbidden):
# 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. import os import socket from moniker.openstack.common import cfg cfg.CONF.register_opts([ cfg.StrOpt('pybasedir', default=os.path.abspath(os.path.join(os.path.dirname(__file__), '../')), help='Directory where the nova python module is installed'), cfg.StrOpt('host', default=socket.gethostname(), help='Name of this node'), cfg.StrOpt('control-exchange', default='moniker', help='AMQP exchange to connect to if using RabbitMQ or Qpid'), cfg.StrOpt('central-topic', default='central', help='Central Topic'), cfg.StrOpt('agent-topic', default='agent', help='Agent Topic'), cfg.StrOpt('state-path', default='$pybasedir', help='State Path'), cfg.StrOpt('templates-path', default='$pybasedir/templates', help='Templates Path'), ])
import eventlet import greenlet import kombu import kombu.connection import kombu.entity import kombu.messaging from moniker.openstack.common import cfg from moniker.openstack.common.gettextutils import _ from moniker.openstack.common.rpc import amqp as rpc_amqp from moniker.openstack.common.rpc import common as rpc_common from moniker.openstack.common import network_utils kombu_opts = [ cfg.StrOpt('kombu_ssl_version', default='', help='SSL version to use (valid only if SSL enabled)'), cfg.StrOpt('kombu_ssl_keyfile', default='', help='SSL key file (valid only if SSL enabled)'), cfg.StrOpt('kombu_ssl_certfile', default='', help='SSL cert file (valid only if SSL enabled)'), cfg.StrOpt('kombu_ssl_ca_certs', default='', help=('SSL certification authority file ' '(valid only if SSL enabled)')), cfg.StrOpt('rabbit_host', default='localhost', help='The RabbitMQ broker address where a single node is used'), cfg.IntOpt('rabbit_port',
'xn--kpry57d', 'xn--lgbbat1ad8j', 'xn--mgb9awbf', 'xn--mgbaam7a8h', 'xn--mgbayh7gpa', 'xn--mgbbh1a71e', 'xn--mgbc0a9azcg', 'xn--mgberp4a5d4ar', 'xn--mgbx4cd0ab', 'xn--o3cw4h', 'xn--ogbpf8fl', 'xn--p1ai', 'xn--pgbs0dh', 'xn--s9brj9c', 'xn--wgbh1c', 'xn--wgbl6a', 'xn--xkc2al3hye2a', 'xn--xkc2dl3a5ee0h', 'xn--yfro4i67o', 'xn--ygbi2ammx', 'xn--zckzah', 'xxx', 'ye', 'yt', 'za', 'zm', 'zw' ] cfg.CONF.register_group( cfg.OptGroup(name='service:central', title="Configuration for Central Service")) cfg.CONF.register_opts([ cfg.IntOpt( 'workers', default=None, help='Number of worker processes to spawn'), cfg.StrOpt( 'backend-driver', default='fake', help='The backend driver to use'), cfg.StrOpt('storage-driver', default='sqlalchemy', help='The storage driver to use'), cfg.StrOpt( 'quota-driver', default='storage', help='The quota driver to use'), cfg.ListOpt('enabled-notification-handlers', default=[], help='Enabled Notification Handlers'), cfg.ListOpt('domain-name-blacklist', default=[ '\\.arpa\\.$', '\\.novalocal\\.$', '\\.localhost\\.$', '\\.localdomain\\.$', '\\.local\\.$' ], help='DNS domain name blacklist'), cfg.ListOpt('accepted-tld-list', default=IANA_TLDS, help='Accepted TLDs'),
from moniker.openstack.common import processutils as utils from moniker.openstack.common.rpc import common as rpc_common zmq = importutils.try_import('eventlet.green.zmq') # for convenience, are not modified. pformat = pprint.pformat Timeout = eventlet.timeout.Timeout LOG = rpc_common.LOG RemoteError = rpc_common.RemoteError RPCException = rpc_common.RPCException zmq_opts = [ cfg.StrOpt('rpc_zmq_bind_address', default='*', help='ZeroMQ bind address. Should be a wildcard (*), ' 'an ethernet interface, or IP. ' 'The "host" option should point or resolve to this ' 'address.'), # The module.Class to use for matchmaking. cfg.StrOpt( 'rpc_zmq_matchmaker', default=('moniker.openstack.common.rpc.' 'matchmaker.MatchMakerLocalhost'), help='MatchMaker driver', ), # The following port is unassigned by IANA as of 2012-05-21 cfg.IntOpt('rpc_zmq_port', default=9501, help='ZeroMQ receiver listening port'),
# under the License. import os import pkg_resources import json from jinja2 import Template from moniker.openstack.common import log as logging from moniker.openstack.common import cfg from moniker.openstack.common import processutils from moniker.openstack.common import timeutils from moniker.openstack.common.notifier import api as notifier_api from moniker import exceptions LOG = logging.getLogger(__name__) cfg.CONF.register_opts([ cfg.StrOpt('root-helper', default='sudo moniker-rootwrap /etc/moniker/rootwrap.conf') ]) def notify(context, service, event_type, payload): priority = 'INFO' publisher_id = notifier_api.publisher_id(service) event_type = "dns.%s" % event_type notifier_api.notify(context, publisher_id, event_type, priority, payload) def find_config(config_path): """ Find a configuration file using the given hint. Code nabbed from cinder.
# Copyright 2012 Hewlett-Packard Development Company, L.P. All Rights Reserved. # # Author: Kiall Mac Innes <*****@*****.**> # # 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 moniker.openstack.common import cfg cfg.CONF.register_group( cfg.OptGroup(name='service:agent', title="Configuration for Agent Service")) cfg.CONF.register_opts([ cfg.IntOpt( 'workers', default=None, help='Number of worker processes to spawn'), cfg.StrOpt( 'backend-driver', default='bind9', help='The backend driver to use'), ], group='service:agent')
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os import subprocess from jinja2 import Template from moniker.openstack.common import cfg from moniker.openstack.common import log as logging from moniker.openstack.common.rpc import service as rpc_service from moniker.openstack.common.context import get_admin_context from moniker.central import api as central_api LOG = logging.getLogger(__name__) cfg.CONF.register_opts([ cfg.StrOpt('rndc-path', default='/usr/sbin/rndc', help='RNDC Path'), cfg.StrOpt('rndc-host', default='127.0.0.1', help='RNDC Host'), cfg.IntOpt('rndc-port', default=953, help='RNDC Port'), cfg.StrOpt('rndc-config-file', default=None, help='RNDC Config File'), cfg.StrOpt('rndc-key-file', default=None, help='RNDC Key File'), ]) class Service(rpc_service.Service): def __init__(self, *args, **kwargs): kwargs.update(host=cfg.CONF.host, topic=cfg.CONF.agent_topic) super(Service, self).__init__(*args, **kwargs) # TODO: This is a hack to ensure the data dir is 100% up to date admin_context = get_admin_context()