Add opts file

Added opts file

added [oslo_limit] group.

keystoneauth options and "endpoint_id" are in this group.

Change-Id: I31e8f7c9f97b7175a7580f720383228e6f355f9a
This commit is contained in:
wangxiyuan 2018-07-23 17:00:26 +08:00
parent 53854f6a51
commit 2773ea9edd
5 changed files with 65 additions and 1 deletions

View File

@ -1,5 +1,7 @@
bandit==1.4.0
hacking==0.12.0
keystoneauth1==3.9.0
oslo.config==5.2.0
oslo.i18n==3.15.3
openstackdocstheme==1.20.0
oslotest==3.2.0

55
oslo_limit/opts.py Normal file
View File

@ -0,0 +1,55 @@
# 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.
__all__ = [
'list_opts',
'register_opts',
]
import copy
from keystoneauth1 import loading
from oslo_config import cfg
from oslo_limit._i18n import _
CONF = cfg.CONF
endpoint_id = cfg.StrOpt(
'endpoint_id',
help=_("The service's endpoint id which is registered in Keystone."))
_options = [
endpoint_id,
]
_option_group = 'oslo_limit'
def list_opts():
"""Return a list of oslo.config options available in the library.
:returns: a list of (group_name, opts) tuples
"""
return [(_option_group,
copy.deepcopy(_options) +
loading.get_session_conf_options() +
loading.get_adapter_conf_options(include_deprecated=False)
)]
def register_opts(conf):
loading.register_session_conf_options(CONF, _option_group)
loading.register_adapter_conf_options(CONF, _option_group,
include_deprecated=False)
conf.register_opts(_options, group=_option_group)

View File

@ -21,9 +21,10 @@ Tests for `limit` module.
import uuid
from oslo_limit import limit
from oslotest import base
from oslo_limit import limit
class TestProjectClaim(base.BaseTestCase):

View File

@ -1,4 +1,6 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
keystoneauth1>=3.9.0 # Apache-2.0
oslo.config>=5.2.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0

View File

@ -22,6 +22,10 @@ classifier =
packages =
oslo_limit
[entry_points]
oslo.config.opts =
oslo.limit = oslo_limit.opts:list_opts
[compile_catalog]
directory = oslo_limit/locale
domain = oslo_limit