efc6e28edc
- Removes the hard-coded magic number of 60 seconds allowing users to choose the period that they require. - Standardise on strings for DictOpt dict keys. When loaded from a config file, the DictOpt keys are parsed as strings, which was conflicting with the default integer dict keys. This caused the periodic engine to silently fail to load when configured via a config file. - Remove unused variable Story: 2006783 Task: 37313 Change-Id: Ibd61c45fc1ade37022150d34a5b00c56fdf69814
62 lines
2.4 KiB
Python
62 lines
2.4 KiB
Python
# Copyright 2017 FUJITSU LIMITED
|
|
#
|
|
# 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 oslo_config import cfg
|
|
|
|
from monasca_notification.conf import types
|
|
|
|
_DEFAULT_URL = '127.0.0.1:2181'
|
|
_DEFAULT_NOTIFICATION_PATH = '/notification/alarms'
|
|
_DEFAULT_RETRY_PATH = '/notification/retry'
|
|
_DEFAULT_PERIODIC_PATH = {
|
|
'60': '/notification/60_seconds'
|
|
}
|
|
|
|
zookeeper_group = cfg.OptGroup('zookeeper',
|
|
title='Zookeeper Options',
|
|
help='Options under this group allow to '
|
|
'configure settings for zookeeper '
|
|
'handling.')
|
|
|
|
zookeeper_opts = [
|
|
cfg.ListOpt(name='url', item_type=types.HostAddressPortType(),
|
|
default=_DEFAULT_URL, required=True,
|
|
help='List of addresses (with ports) pointing '
|
|
'at zookeeper cluster.'),
|
|
cfg.StrOpt(name='notification_path', default=_DEFAULT_NOTIFICATION_PATH,
|
|
required=True, advanced=True,
|
|
help='Path in zookeeper tree to track notification offsets.'),
|
|
cfg.StrOpt(name='notification_retry_path', default=_DEFAULT_RETRY_PATH,
|
|
required=True, advanced=True,
|
|
help='Path in zookeeper tree to track notification '
|
|
'retries offsets.'),
|
|
cfg.DictOpt(name='periodic_path', default=_DEFAULT_PERIODIC_PATH,
|
|
required=True, advanced=True,
|
|
help='Paths in zookeeper tree to track periodic offsets. '
|
|
'Keys must be integers describing the interval '
|
|
'of periodic notification. Values are actual '
|
|
'paths inside zookeeper tree.')
|
|
]
|
|
|
|
|
|
def register_opts(conf):
|
|
conf.register_group(zookeeper_group)
|
|
conf.register_opts(zookeeper_opts, group=zookeeper_group)
|
|
|
|
|
|
def list_opts():
|
|
return {
|
|
zookeeper_group: zookeeper_opts
|
|
}
|