87 lines
3.2 KiB
Python
87 lines
3.2 KiB
Python
# Copyright 2016 Huawei Technologies Co.,LTD.
|
|
# All Rights Reserved.
|
|
#
|
|
# 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
|
|
import tempfile
|
|
|
|
from oslo_config import cfg
|
|
|
|
from mogan.common.i18n import _
|
|
|
|
api_opts = [
|
|
cfg.BoolOpt('debug_tracebacks_in_api',
|
|
default=False,
|
|
help=_('Return server tracebacks in the API response for any '
|
|
'error responses. WARNING: this is insecure '
|
|
'and should not be used in a production environment.')),
|
|
]
|
|
|
|
exc_log_opts = [
|
|
cfg.BoolOpt('fatal_exception_format_errors',
|
|
default=False,
|
|
help=_('Used if there is a formatting error when generating '
|
|
'an exception message (a programming error). If True, '
|
|
'raise an exception; if False, use the unformatted '
|
|
'message.')),
|
|
]
|
|
|
|
path_opts = [
|
|
cfg.StrOpt('pybasedir',
|
|
default=os.path.abspath(os.path.join(os.path.dirname(__file__),
|
|
'../')),
|
|
sample_default='/usr/lib/python/site-packages/mogan/mogan',
|
|
help=_('Directory where the mogan python module is '
|
|
'installed.')),
|
|
cfg.StrOpt('bindir',
|
|
default='$pybasedir/bin',
|
|
help=_('Directory where mogan binaries are installed.')),
|
|
cfg.StrOpt('state_path',
|
|
default='$pybasedir',
|
|
help=_("Top-level directory for maintaining mogan's state.")),
|
|
]
|
|
|
|
service_opts = [
|
|
cfg.IntOpt('periodic_interval',
|
|
default=60,
|
|
help=_('Default interval (in seconds) for running periodic '
|
|
'tasks.')),
|
|
cfg.HostAddressOpt('host',
|
|
default=socket.getfqdn(),
|
|
sample_default='localhost',
|
|
help=_('Name of this node. This can be an opaque '
|
|
'identifier. It is not necessarily a hostname, '
|
|
'FQDN, or IP address. However, the node name '
|
|
'must be valid within an AMQP key, and if using '
|
|
'ZeroMQ, a valid hostname, FQDN, or IP address.')
|
|
),
|
|
]
|
|
|
|
utils_opts = [
|
|
cfg.StrOpt('tempdir',
|
|
default=tempfile.gettempdir(),
|
|
sample_default='/tmp',
|
|
help=_('Temporary working directory, default is Python temp '
|
|
'dir.')),
|
|
]
|
|
|
|
|
|
def register_opts(conf):
|
|
conf.register_opts(api_opts)
|
|
conf.register_opts(exc_log_opts)
|
|
conf.register_opts(service_opts)
|
|
conf.register_opts(path_opts)
|
|
conf.register_opts(utils_opts)
|