~xianghui/ubuntu/trusty/oslo.messaging/icehouse-lp1521958

« back to all changes in this revision

Viewing changes to oslo/messaging/opts.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2014-02-07 14:32:19 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20140207143219-faeitvpdrypb1c9x
Tags: 1.3.0~a7-0ubuntu1
* New upstream release.
* debian/control:
  - Add python-yaml, python-babel, python-six, python-mox3,
    python-mock as build dependency.
  - Dropped python-d2to1 as a dependency.
* wrap and sort.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
# Copyright 2014 Red Hat, Inc.
 
3
#
 
4
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
5
#    not use this file except in compliance with the License. You may obtain
 
6
#    a copy of the License at
 
7
#
 
8
#         http://www.apache.org/licenses/LICENSE-2.0
 
9
#
 
10
#    Unless required by applicable law or agreed to in writing, software
 
11
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
12
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
13
#    License for the specific language governing permissions and limitations
 
14
#    under the License.
 
15
 
 
16
__all__ = [
 
17
    'list_opts'
 
18
]
 
19
 
 
20
import copy
 
21
import itertools
 
22
 
 
23
from oslo.messaging._drivers import amqp
 
24
from oslo.messaging._drivers import common as drivers_common
 
25
from oslo.messaging._drivers import impl_qpid
 
26
from oslo.messaging._drivers import impl_rabbit
 
27
from oslo.messaging._drivers import impl_zmq
 
28
from oslo.messaging._drivers import matchmaker
 
29
from oslo.messaging._drivers import matchmaker_redis
 
30
from oslo.messaging._drivers import matchmaker_ring
 
31
from oslo.messaging._executors import impl_eventlet
 
32
from oslo.messaging.notify import notifier
 
33
from oslo.messaging.rpc import client
 
34
from oslo.messaging import transport
 
35
 
 
36
_global_opt_lists = [
 
37
    amqp.amqp_opts,
 
38
    drivers_common._exception_opts,
 
39
    impl_qpid.qpid_opts,
 
40
    impl_rabbit.rabbit_opts,
 
41
    impl_zmq.zmq_opts,
 
42
    matchmaker.matchmaker_opts,
 
43
    matchmaker_redis.matchmaker_redis_opts,
 
44
    impl_eventlet._eventlet_opts,
 
45
    notifier._notifier_opts,
 
46
    client._client_opts,
 
47
    transport._transport_opts
 
48
]
 
49
 
 
50
_opts = [
 
51
    (None, list(itertools.chain(*_global_opt_lists))),
 
52
    ('matchmaker_ring', matchmaker_ring.matchmaker_opts),
 
53
]
 
54
 
 
55
 
 
56
def list_opts():
 
57
    """Return a list of oslo.config options available in the library.
 
58
 
 
59
    The returned list includes all oslo.config options which may be registered
 
60
    at runtime by the library.
 
61
 
 
62
    Each element of the list is a tuple. The first element is the name of the
 
63
    group under which the list of elements in the second element will be
 
64
    registered. A group name of None corresponds to the [DEFAULT] group in
 
65
    config files.
 
66
 
 
67
    This function is also discoverable via the 'oslo.messaging' entry point
 
68
    under the 'oslo.config.opts' namespace.
 
69
 
 
70
    The purpose of this is to allow tools like the Oslo sample config file
 
71
    generator to discover the options exposed to users by this library.
 
72
 
 
73
    :returns: a list of (group_name, opts) tuples
 
74
    """
 
75
    return [(g, copy.deepcopy(o)) for g, o in _opts]