Example #1
0
def register_keystoneauth_opts(conf):
    ka_loading.register_auth_conf_options(conf, CFG_GROUP)
    ka_loading.register_session_conf_options(
        conf,
        CFG_GROUP,
        deprecated_opts={
            'cacert': [
                cfg.DeprecatedOpt('os-cacert', group=CFG_GROUP),
                cfg.DeprecatedOpt('os-cacert', group="DEFAULT")
            ]
        })
Example #2
0
def _register_keystoneauth_group(conf, group):
    ka_loading.register_auth_conf_options(conf, group)
    ka_loading.register_session_conf_options(
        conf,
        group,
        deprecated_opts={
            'cacert': [
                cfg.DeprecatedOpt('os-cacert', group=group),
                cfg.DeprecatedOpt('os-cacert', group="DEFAULT")
            ]
        })
    conf.register_opts(CLI_OPTS, group=group)
Example #3
0
def register_opts(conf):
    conf.register_group(glance_group)
    conf.register_opts(glance_opts, group=glance_group)

    deprecated = {
        'insecure':
        [cfg.DeprecatedOpt('api_insecure', group=glance_group.name)],
        'cafile': [cfg.DeprecatedOpt('ca_file', group="ssl")],
        'certfile': [cfg.DeprecatedOpt('cert_file', group="ssl")],
        'keyfile': [cfg.DeprecatedOpt('key_file', group="ssl")],
    }
    ks_loading.register_session_conf_options(conf, glance_group.name,
                                             deprecated)
Example #4
0
def register_keystoneauth_opts(conf):
    ka_loading.register_auth_conf_options(conf, CFG_GROUP)
    ka_loading.register_session_conf_options(
        conf,
        CFG_GROUP,
        deprecated_opts={
            'cacert': [
                cfg.DeprecatedOpt('os-cacert', group=CFG_GROUP),
                cfg.DeprecatedOpt('os-cacert', group="DEFAULT")
            ]
        })
    conf.set_default("auth_type",
                     default="password-aodh-legacy",
                     group=CFG_GROUP)
Example #5
0
def register_designate_opts(CONF=cfg.CONF):
    CONF.register_opts(designate_opts, 'designate')
    loading.register_auth_conf_options(CONF, 'designate')
    loading.register_session_conf_options(
        conf=CONF,
        group='designate',
        deprecated_opts={'cafile': [cfg.DeprecatedOpt('ca_cert')]})
 def get_options(cls):
     # NOTE(jamielennox): this is kind of horrible. If you specify this as
     # a deprecated_name= value it will convert - to _ which is not what we
     # want for a CLI option.
     deprecated = [cfg.DeprecatedOpt('test-other')]
     return [
         cfg.StrOpt('test-opt', help='tester', deprecated_opts=deprecated)
     ]
Example #7
0
def connect_gnocchi():
    conf = cfg.ConfigOpts()
    loading.register_auth_conf_options(conf, "keystone_authtoken")
    loading.register_session_conf_options(
        conf,
        "keystone_authtoken",
        deprecated_opts={
            'cacert': [
                cfg.DeprecatedOpt('os-cacert', group="keystone_authtoken"),
                cfg.DeprecatedOpt('os-cacert', group="DEFAULT")
            ]
        })
    conf([], project='gnocchi')

    auth_plugin = loading.load_auth_from_conf_options(conf,
                                                      "keystone_authtoken")
    conn_gnocchi = client.Client(session_options={'auth': auth_plugin})
    return conn_gnocchi
Example #8
0
def make_opt(option, opt_hash, ns_hash):
    """Declares a new group

    :param name: an option retrieved from json.
    :param opt_hash: the option hash
    :param ns_hash: the hash of the namespace defining it.
    :return: an oslo config option representation augmented with the hashes.
    """
    name = option.get('name', None)
    deprecateds = []

    if option.get('deprecated_opts', None):
        for depr_descr in option.get('deprecated_opts', {}):
            depr_name = depr_descr.get('name', None)
            if depr_name is None:
                depr_name = name
            depr_opt = cfg.DeprecatedOpt(depr_name,
                                         depr_descr.get('group', None))
            deprecateds.append(depr_opt)

    if 'type' in option:
        cfgtype = make_type(option['type'])
    else:
        cfgtype = None

    default = option.get('default', None)
    if default and cfgtype:
        try:
            default = cfgtype(default)
        except Exception:
            _, err, _ = sys.exc_info()
            LOG.error('Invalid default value (%s, %s): %s' %
                      (name, default, err))
    try:
        cfgopt = IdentifiedOpt(
            id_=opt_hash,
            ns_id=ns_hash,
            name=name,
            type=cfgtype,
            dest=option.get('dest', None),
            default=default,
            positional=option.get('positional', None),
            help=option.get('help', None),
            secret=option.get('secret', None),
            required=option.get('required', None),
            sample_default=option.get('sample_default', None),
            deprecated_for_removal=option.get('deprecated_for_removal', None),
            deprecated_reason=option.get('deprecated_reason', None),
            deprecated_opts=deprecateds,
            mutable=option.get('mutable', None))
    except Exception:
        cfgopt = None
        _, err, _ = sys.exc_info()
        LOG.error('Invalid option definition (%s in %s): %s' %
                  (name, ns_hash, err))
    return cfgopt
Example #9
0
    def _to_oslo_opt(self):
        if not cfg:
            raise ImportError("oslo.config is not an automatic dependency of "
                              "keystoneauth. If you wish to use oslo.config "
                              "you need to import it into your application's "
                              "requirements file. ")

        deprecated_opts = [cfg.DeprecatedOpt(o.name) for o in self.deprecated]

        return cfg.Opt(name=self.name,
                       type=self.type,
                       help=self.help,
                       secret=self.secret,
                       required=self.required,
                       dest=self.dest,
                       deprecated_opts=deprecated_opts,
                       metavar=self.metavar)
Example #10
0
    def __init__(self, conf):
        """
        Initialize the Store
        """

        super(Store, self).__init__()

        self.conf = conf
        self.store_location_class = None

        try:
            if self.OPTIONS is not None:
                # NOTE(flaper87): To be removed in k-2. This should
                # give deployers enough time to migrate their systems
                # and move configs under the new section.
                for opt in self.OPTIONS:
                    opt.deprecated_opts = [
                        cfg.DeprecatedOpt(opt.name, group='DEFAULT')
                    ]
                self.conf.register_opts(self.OPTIONS, group='glance_store')
        except cfg.DuplicateOptError:
            pass
Keymap for VNC.

The keyboard mapping (keymap) determines which keyboard layout a VNC
session should use by default.

Possible values:

* A keyboard layout which is supported by the underlying hypervisor on
  this node. This is usually an 'IETF language tag' (for example
  'en-us').  If you use QEMU as hypervisor, you should find the  list
  of supported keyboard layouts at ``/usr/share/qemu/keymaps``.
"""),
    cfg.HostAddressOpt('server_listen',
                       default='127.0.0.1',
                       deprecated_opts=[
                           cfg.DeprecatedOpt('vncserver_listen',
                                             group='DEFAULT'),
                           cfg.DeprecatedOpt('vncserver_listen', group='vnc'),
                       ],
                       help="""
The IP address or hostname on which an instance should listen to for
incoming VNC connection requests on this node.
"""),
    cfg.HostAddressOpt('server_proxyclient_address',
                       default='127.0.0.1',
                       deprecated_opts=[
                           cfg.DeprecatedOpt('vncserver_proxyclient_address',
                                             group='DEFAULT'),
                           cfg.DeprecatedOpt('vncserver_proxyclient_address',
                                             group='vnc'),
                       ],
                       help="""
Example #12
0
# 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 copy

from keystoneauth1 import exceptions as kaexception
from keystoneauth1 import loading as kaloading
from oslo_config import cfg
from oslo_log import log

LOG = log.getLogger(__name__)
LEGACY_SECTION = 'keystone_authtoken'
OLD_SESSION_OPTS = {
    'certfile': [cfg.DeprecatedOpt('certfile', LEGACY_SECTION)],
    'keyfile': [cfg.DeprecatedOpt('keyfile', LEGACY_SECTION)],
    'cafile': [cfg.DeprecatedOpt('cafile', LEGACY_SECTION)],
    'insecure': [cfg.DeprecatedOpt('insecure', LEGACY_SECTION)],
    'timeout': [cfg.DeprecatedOpt('timeout', LEGACY_SECTION)],
}

# FIXME(pas-ha) remove import of auth_token section after deprecation period
cfg.CONF.import_group(LEGACY_SECTION, 'keystonemiddleware.auth_token')


def load_auth(conf, group):
    try:
        auth = kaloading.load_auth_from_conf_options(conf, group)
    except kaexception.MissingRequiredOptions as exc:
        LOG.debug('Failed to load credentials from group %(grp)s: %(err)s', {
Example #13
0
 cfg.StrOpt('class_configs',
            default='/etc/murano/class-configs',
            help=_('Path to class configuration files')),
 cfg.BoolOpt('use_trusts',
             default=True,
             help=_("Create resources using trust token rather "
                    "than user's token")),
 cfg.BoolOpt('enable_model_policy_enforcer',
             default=False,
             help=_('Enable model policy enforcer using Congress')),
 cfg.IntOpt('agent_timeout',
            default=3600,
            help=_('Time for waiting for a response from murano agent '
                   'during the deployment')),
 cfg.IntOpt('engine_workers',
            deprecated_opts=[cfg.DeprecatedOpt('workers', group='engine')],
            help=_('Number of engine workers')),
 cfg.ListOpt('load_packages_from',
             default=[],
             help=_('List of directories to load local packages from. '
                    'If not provided, packages will be loaded only API'),
             deprecated_group='packages_opts'),
 cfg.StrOpt('packages_cache',
            help='Location (directory) for Murano package cache.',
            deprecated_group='packages_opts'),
 cfg.BoolOpt('enable_packages_cache',
             default=True,
             help=_('Enables murano-engine to persist on disk '
                    'packages downloaded during deployments. '
                    'The packages would be re-used for consequent '
                    'deployments.'),
Example #14
0
Related Options:
    * flavor

""")),
]
image_format_opts = [
    cfg.ListOpt('container_formats',
                default=[
                    'ami', 'ari', 'aki', 'bare', 'ovf', 'ova', 'docker',
                    'compressed'
                ],
                help=_("Supported values for the 'container_format' "
                       "image attribute"),
                deprecated_opts=[
                    cfg.DeprecatedOpt('container_formats', group='DEFAULT')
                ]),
    cfg.ListOpt(
        'disk_formats',
        default=[
            'ami', 'ari', 'aki', 'vhd', 'vhdx', 'vmdk', 'raw', 'qcow2', 'vdi',
            'iso', 'ploop'
        ],
        help=_("Supported values for the 'disk_format' "
               "image attribute"),
        deprecated_opts=[cfg.DeprecatedOpt('disk_formats', group='DEFAULT')]),
]
task_opts = [
    cfg.IntOpt('task_time_to_live',
               default=48,
               help=_("Time in hours for which a task lives after, either "
 def new_deprecated():
     return cfg.DeprecatedOpt(uuid.uuid4().hex, group=uuid.uuid4().hex)
Example #16
0
from cinder import i18n
i18n.enable_lazy()

# Need to register global_opts
from cinder.common import config  # noqa
from cinder.db import api as session
from cinder.i18n import _, _LW
from cinder import service
from cinder import utils
from cinder import version


CONF = cfg.CONF

deprecated_host_opt = cfg.DeprecatedOpt('host')
host_opt = cfg.StrOpt('backend_host', help='Backend override of host value.',
                      deprecated_opts=[deprecated_host_opt])
CONF.register_cli_opt(host_opt)

# TODO(geguileo): Once we complete the work on A-A update the option's help.
cluster_opt = cfg.StrOpt('cluster',
                         default=None,
                         help='Name of this cluster.  Used to group volume '
                              'hosts that share the same backend '
                              'configurations to work in HA Active-Active '
                              'mode.  Active-Active is not yet supported.')
CONF.register_opt(cluster_opt)


def main():
Example #17
0
revocation event may be removed from the backend.
"""))

caching = cfg.BoolOpt(
    'caching',
    default=True,
    help=utils.fmt("""
Toggle for revocation event caching. This has no effect unless global caching
is enabled.
"""))

cache_time = cfg.IntOpt(
    'cache_time',
    default=3600,
    deprecated_opts=[
        cfg.DeprecatedOpt('revocation_cache_time', group='token')],
    help=utils.fmt("""
Time to cache the revocation list and the revocation events (in seconds). This
has no effect unless global and token caching are enabled.
"""))


GROUP_NAME = __name__.split('.')[-1]
ALL_OPTS = [
    driver,
    expiration_buffer,
    caching,
    cache_time,
]

Example #18
0
        'will match the default conductor group, and is different than '
        'leaving the option unset.'),
    cfg.ListOpt(
        'peer_list',
        default=[],
        mutable=True,
        help='List of hostnames for all nova-compute services (including '
        'this host) with this partition_key config value. '
        'Nodes matching the partition_key value will be distributed '
        'between all services specified here. '
        'If partition_key is unset, this option is ignored.'),
]

deprecated_opts = {
    'endpoint_override':
    [cfg.DeprecatedOpt('api_endpoint', group=ironic_group.name)]
}


def register_opts(conf):
    conf.register_group(ironic_group)
    conf.register_opts(ironic_options, group=ironic_group)
    confutils.register_ksa_opts(conf,
                                ironic_group,
                                DEFAULT_SERVICE_TYPE,
                                deprecated_opts=deprecated_opts)


def list_opts():
    return {
        ironic_group:
Example #19
0
OLD_OPTS = [
    cfg.StrOpt('database_connection',
               secret=True,
               help='DEPRECATED - Database connection string.',
               ),
]

cfg.CONF.register_opts(OLD_OPTS)


OPTS = [
    cfg.IntOpt('metering_time_to_live',
               default=-1,
               help="Number of seconds that samples are kept "
               "in the database for (<= 0 means forever).",
               deprecated_opts=[cfg.DeprecatedOpt('time_to_live',
                                                  'database')]),
    cfg.IntOpt('event_time_to_live',
               default=-1,
               help=("Number of seconds that events are kept "
                     "in the database for (<= 0 means forever).")),
    cfg.StrOpt('metering_connection',
               secret=True,
               help='The connection string used to connect to the metering '
               'database. (if unset, connection is used)'),
    cfg.StrOpt('event_connection',
               secret=True,
               help='The connection string used to connect to the event '
               'database. (if unset, connection is used)'),
    cfg.IntOpt('db2nosql_resource_id_maxlen',
               default=512,
               help="The max length of resources id in DB2 nosql, "
Example #20
0
from ceilometer.alarm.partition import coordination as alarm_coordination
from ceilometer.alarm import rpc as rpc_alarm
from ceilometer import coordination as coordination
from ceilometer.i18n import _
from ceilometer import messaging
from ceilometer.openstack.common import log
from ceilometer.openstack.common import service as os_service


OPTS = [
    cfg.IntOpt('evaluation_interval',
               default=60,
               help='Period of evaluation cycle, should'
                    ' be >= than configured pipeline interval for'
                    ' collection of underlying metrics.',
               deprecated_opts=[cfg.DeprecatedOpt(
                   'threshold_evaluation_interval', group='alarm')]),
]

cfg.CONF.register_opts(OPTS, group='alarm')
cfg.CONF.import_opt('http_timeout', 'ceilometer.service')
cfg.CONF.import_group('service_credentials', 'ceilometer.service')

LOG = log.getLogger(__name__)


@six.add_metaclass(abc.ABCMeta)
class AlarmService(object):

    def __init__(self):
        super(AlarmService, self).__init__()
        self._load_evaluators()
from osc_lib.i18n import _
from oslo_config import cfg

from tripleoclient import constants

from tripleoclient.config.standalone import StandaloneConfig

CONF = cfg.CONF

# Control plane network name
SUBNETS_DEFAULT = ['ctlplane-subnet']

# Deprecated options
_deprecated_opt_network_gateway = [
    cfg.DeprecatedOpt('network_gateway', group='DEFAULT')
]
_deprecated_opt_network_cidr = [
    cfg.DeprecatedOpt('network_cidr', group='DEFAULT')
]
_deprecated_opt_dhcp_start = [cfg.DeprecatedOpt('dhcp_start', group='DEFAULT')]
_deprecated_opt_dhcp_end = [cfg.DeprecatedOpt('dhcp_end', group='DEFAULT')]
_deprecated_opt_inspection_iprange = [
    cfg.DeprecatedOpt('inspection_iprange', group='DEFAULT')
]


class UndercloudConfig(StandaloneConfig):
    def get_undercloud_service_opts(self):
        return super(UndercloudConfig,
                     self).get_enable_service_opts(cinder=False,
Example #22
0
                default='wsgi-basic-paste.ini',
                help='Name of the paste configuration file that defines '
                'the available pipelines.'),
 ],
 'eventlet_server': [
     cfg.IntOpt('public_workers',
                deprecated_name='public_workers',
                deprecated_group='DEFAULT',
                deprecated_for_removal=True,
                help='The number of worker processes to serve the public '
                'eventlet application. Defaults to number of CPUs '
                '(minimum of 2).'),
     cfg.StrOpt('public_bind_host',
                default='0.0.0.0',
                deprecated_opts=[
                    cfg.DeprecatedOpt('bind_host', group='DEFAULT'),
                    cfg.DeprecatedOpt('public_bind_host', group='DEFAULT'),
                ],
                deprecated_for_removal=True,
                help='The IP address of the network interface for the '
                'public service to listen on.'),
     cfg.IntOpt('public_port',
                default=5000,
                deprecated_name='public_port',
                deprecated_group='DEFAULT',
                deprecated_for_removal=True,
                help='The port number which the public service listens '
                'on.'),
     cfg.BoolOpt('wsgi_keep_alive',
                 default=True,
                 help="If set to false, disables keepalives on the server; "
Example #23
0
from neutron_lbaas.services.loadbalancer import constants as lb_const
from neutron_lbaas.services.loadbalancer.drivers.haproxy import cfg as hacfg

LOG = logging.getLogger(__name__)
NS_PREFIX = 'qlbaas-'
DRIVER_NAME = 'haproxy_ns'

STATE_PATH_DEFAULT = '$state_path/lbaas'
USER_GROUP_DEFAULT = 'nogroup'
OPTS = [
    cfg.StrOpt(
        'loadbalancer_state_path',
        default=STATE_PATH_DEFAULT,
        help=_('Location to store config and state files'),
        deprecated_opts=[
            cfg.DeprecatedOpt('loadbalancer_state_path', group='DEFAULT')
        ],
    ),
    cfg.StrOpt(
        'user_group',
        default=USER_GROUP_DEFAULT,
        help=_('The user group'),
        deprecated_opts=[cfg.DeprecatedOpt('user_group', group='DEFAULT')],
    ),
    cfg.IntOpt(
        'send_gratuitous_arp',
        default=3,
        help=_('When delete and re-add the same vip, send this many '
               'gratuitous ARPs to flush the ARP cache in the Router. '
               'Set it below or equal to 0 to disable this feature.'),
    )
Example #24
0
class GeneratorTestCase(base.BaseTestCase):

    groups = {
        'group1':
        cfg.OptGroup(name='group1',
                     help='Lorem ipsum dolor sit amet, consectetur '
                     'adipisicing elit, sed do eiusmod tempor '
                     'incididunt ut labore et dolore magna '
                     'aliqua. Ut enim ad minim veniam, quis '
                     'nostrud exercitation ullamco laboris '
                     'nisi ut aliquip ex ea commodo '
                     'consequat. Duis aute irure dolor in.'),
        'group2':
        cfg.OptGroup(name='group2', title='Group 2'),
        'foo':
        cfg.OptGroup(name='foo', title='Foo Title', help='foo help'),
    }

    opts = {
        'foo':
        cfg.StrOpt('foo', help='foo option'),
        'bar':
        cfg.StrOpt('bar', help='bar option'),
        'foo-bar':
        cfg.StrOpt('foo-bar', help='foobar'),
        'no_help':
        cfg.StrOpt('no_help'),
        'long_help':
        cfg.StrOpt('long_help',
                   help='Lorem ipsum dolor sit amet, consectetur '
                   'adipisicing elit, sed do eiusmod tempor '
                   'incididunt ut labore et dolore magna '
                   'aliqua. Ut enim ad minim veniam, quis '
                   'nostrud exercitation ullamco laboris '
                   'nisi ut aliquip ex ea commodo '
                   'consequat. Duis aute irure dolor in '
                   'reprehenderit in voluptate velit esse '
                   'cillum dolore eu fugiat nulla '
                   'pariatur. Excepteur sint occaecat '
                   'cupidatat non proident, sunt in culpa '
                   'qui officia deserunt mollit anim id est '
                   'laborum.'),
        'long_help_pre':
        cfg.StrOpt('long_help_pre',
                   help='This is a very long help text which '
                   'is preformatted with line breaks. '
                   'It should break when it is too long '
                   'but also keep the specified line '
                   'breaks. This makes it possible to '
                   'create lists with items:\n'
                   '\n'
                   '* item 1\n'
                   '* item 2\n'
                   '\n'
                   'and should increase the '
                   'readability.'),
        'choices_opt':
        cfg.StrOpt('choices_opt',
                   default='a',
                   choices=(None, '', 'a', 'b', 'c'),
                   help='a string with choices'),
        'deprecated_opt_without_deprecated_group':
        cfg.StrOpt('bar', deprecated_name='foobar', help='deprecated'),
        'deprecated_for_removal_opt':
        cfg.StrOpt('bar',
                   deprecated_for_removal=True,
                   help='deprecated for removal'),
        'deprecated_reason_opt':
        cfg.BoolOpt(
            'turn_off_stove',
            default=False,
            deprecated_for_removal=True,
            deprecated_reason='This was supposed to work but it really, '
            'really did not. Always buy house insurance.',
            help='DEPRECATED: Turn off stove'),
        'deprecated_opt_with_deprecated_since':
        cfg.BoolOpt('tune_in',
                    deprecated_for_removal=True,
                    deprecated_since='13.0'),
        'deprecated_opt_with_deprecated_group':
        cfg.StrOpt('bar',
                   deprecated_name='foobar',
                   deprecated_group='group1',
                   help='deprecated'),
        'opt_with_DeprecatedOpt':
        cfg.BoolOpt(
            'foo-bar',
            help='Opt with DeprecatedOpt',
            deprecated_opts=[cfg.DeprecatedOpt('foo-bar',
                                               group='deprecated')]),
        # Unknown Opt default must be a string
        'unknown_type':
        cfg.Opt('unknown_opt',
                default='123',
                help='unknown',
                type=types.String(type_name='unknown type')),
        'str_opt':
        cfg.StrOpt('str_opt', default='foo bar', help='a string'),
        'str_opt_sample_default':
        cfg.StrOpt('str_opt', default='fooishbar', help='a string'),
        'str_opt_with_space':
        cfg.StrOpt('str_opt',
                   default='  foo bar  ',
                   help='a string with spaces'),
        'bool_opt':
        cfg.BoolOpt('bool_opt', default=False, help='a boolean'),
        'int_opt':
        cfg.IntOpt('int_opt', default=10, min=1, max=20, help='an integer'),
        'int_opt_min_0':
        cfg.IntOpt('int_opt_min_0',
                   default=10,
                   min=0,
                   max=20,
                   help='an integer'),
        'int_opt_max_0':
        cfg.IntOpt('int_opt_max_0', default=-1, max=0, help='an integer'),
        'float_opt':
        cfg.FloatOpt('float_opt', default=0.1, help='a float'),
        'list_opt':
        cfg.ListOpt('list_opt', default=['1', '2', '3'], help='a list'),
        'dict_opt':
        cfg.DictOpt('dict_opt', default={
            '1': 'yes',
            '2': 'no'
        }, help='a dict'),
        'ip_opt':
        cfg.IPOpt('ip_opt', default='127.0.0.1', help='an ip address'),
        'port_opt':
        cfg.PortOpt('port_opt', default=80, help='a port'),
        'hostname_opt':
        cfg.HostnameOpt('hostname_opt',
                        default='compute01.nova.site1',
                        help='a hostname'),
        'uri_opt':
        cfg.URIOpt('uri_opt', default='http://example.com', help='a URI'),
        'multi_opt':
        cfg.MultiStrOpt('multi_opt',
                        default=['1', '2', '3'],
                        help='multiple strings'),
        'multi_opt_none':
        cfg.MultiStrOpt('multi_opt_none', help='multiple strings'),
        'multi_opt_empty':
        cfg.MultiStrOpt('multi_opt_empty', default=[],
                        help='multiple strings'),
        'multi_opt_sample_default':
        cfg.MultiStrOpt('multi_opt',
                        default=['1', '2', '3'],
                        sample_default=['5', '6'],
                        help='multiple strings'),
        'string_type_with_bad_default':
        cfg.Opt('string_type_with_bad_default',
                help='string with bad default',
                default=4096),
        'native_str_type':
        cfg.Opt('native_str_type', help='native help', type=str),
        'native_int_type':
        cfg.Opt('native_int_type', help='native help', type=int),
        'native_float_type':
        cfg.Opt('native_float_type', help='native help', type=float),
        'custom_type':
        cfg.Opt('custom_type', help='custom help', type=custom_type),
        'custom_type_name':
        cfg.Opt('custom_opt_type',
                type=types.Integer(type_name='port'
                                   ' number'),
                default=5511,
                help='this is a port'),
    }

    content_scenarios = [
        ('empty', dict(opts=[], expected='''[DEFAULT]
''')),
        ('single_namespace',
         dict(opts=[('test', [(None, [opts['foo']])])],
              expected='''[DEFAULT]

#
# From test
#

# foo option (string value)
#foo = <None>
''')),
        ('multiple_namespaces',
         dict(opts=[('test', [(None, [opts['foo']])]),
                    ('other', [(None, [opts['bar']])])],
              expected='''[DEFAULT]

#
# From other
#

# bar option (string value)
#bar = <None>

#
# From test
#

# foo option (string value)
#foo = <None>
''')),
        ('group',
         dict(opts=[('test', [(groups['group1'], [opts['foo']])])],
              expected='''[DEFAULT]


[group1]
# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
# eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
# ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
# aliquip ex ea commodo consequat. Duis aute irure dolor in.

#
# From test
#

# foo option (string value)
#foo = <None>
''')),
        ('empty_group',
         dict(opts=[('test', [(groups['group1'], [])])],
              expected='''[DEFAULT]
''')),
        ('multiple_groups',
         dict(opts=[('test', [(groups['group1'], [opts['foo']]),
                              (groups['group2'], [opts['bar']])])],
              expected='''[DEFAULT]


[group1]
# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
# eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
# ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
# aliquip ex ea commodo consequat. Duis aute irure dolor in.

#
# From test
#

# foo option (string value)
#foo = <None>


[group2]

#
# From test
#

# bar option (string value)
#bar = <None>
''')),
        ('group_in_multiple_namespaces',
         dict(opts=[('test', [(groups['group1'], [opts['foo']])]),
                    ('other', [(groups['group1'], [opts['bar']])])],
              expected='''[DEFAULT]


[group1]
# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
# eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
# ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
# aliquip ex ea commodo consequat. Duis aute irure dolor in.

#
# From other
#

# bar option (string value)
#bar = <None>

#
# From test
#

# foo option (string value)
#foo = <None>
''')),
        ('hyphenated_name',
         dict(opts=[('test', [(None, [opts['foo-bar']])])],
              expected='''[DEFAULT]

#
# From test
#

# foobar (string value)
#foo_bar = <None>
''')),
        ('no_help',
         dict(opts=[('test', [(None, [opts['no_help']])])],
              log_warning=('"%s" is missing a help string', 'no_help'),
              expected='''[DEFAULT]

#
# From test
#

# (string value)
#no_help = <None>
''')),
        ('long_help',
         dict(opts=[('test', [(None, [opts['long_help']])])],
              expected='''[DEFAULT]

#
# From test
#

# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
# eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
# ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
# aliquip ex ea commodo consequat. Duis aute irure dolor in
# reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
# pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
# culpa qui officia deserunt mollit anim id est laborum. (string
# value)
#long_help = <None>
''')),
        ('long_help_wrap_at_40',
         dict(opts=[('test', [(None, [opts['long_help']])])],
              wrap_width=40,
              expected='''[DEFAULT]

#
# From test
#

# Lorem ipsum dolor sit amet,
# consectetur adipisicing elit, sed do
# eiusmod tempor incididunt ut labore et
# dolore magna aliqua. Ut enim ad minim
# veniam, quis nostrud exercitation
# ullamco laboris nisi ut aliquip ex ea
# commodo consequat. Duis aute irure
# dolor in reprehenderit in voluptate
# velit esse cillum dolore eu fugiat
# nulla pariatur. Excepteur sint
# occaecat cupidatat non proident, sunt
# in culpa qui officia deserunt mollit
# anim id est laborum. (string value)
#long_help = <None>
''')),
        (
            'long_help_no_wrapping',
            dict(
                opts=[('test', [(None, [opts['long_help']])])],
                wrap_width=0,
                expected='''[DEFAULT]

#
# From test
#

'''

                # noqa
                '# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod '
                'tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, '
                'quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo '
                'consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse '
                'cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat '
                'non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. '
                '(string value)'
                '''
#long_help = <None>
''')),
        ('long_help_with_preformatting',
         dict(opts=[('test', [(None, [opts['long_help_pre']])])],
              wrap_width=70,
              expected='''[DEFAULT]

#
# From test
#

# This is a very long help text which is preformatted with line
# breaks. It should break when it is too long but also keep the
# specified line breaks. This makes it possible to create lists with
# items:
#
# * item 1
# * item 2
#
# and should increase the readability. (string value)
#long_help_pre = <None>
''')),
        ('choices_opt',
         dict(opts=[('test', [(None, [opts['choices_opt']])])],
              expected='''[DEFAULT]

#
# From test
#

# a string with choices (string value)
# Allowed values: <None>, '', a, b, c
#choices_opt = a
''')),
        ('deprecated opt without deprecated group',
         dict(opts=[('test', [
             (groups['foo'], [opts['deprecated_opt_without_deprecated_group']])
         ])],
              expected='''[DEFAULT]


[foo]
# foo help

#
# From test
#

# deprecated (string value)
# Deprecated group/name - [foo]/foobar
#bar = <None>
''')),
        ('deprecated_for_removal',
         dict(opts=[('test', [(groups['foo'],
                               [opts['deprecated_for_removal_opt']])])],
              expected='''[DEFAULT]


[foo]
# foo help

#
# From test
#

# DEPRECATED: deprecated for removal (string value)
# This option is deprecated for removal.
# Its value may be silently ignored in the future.
#bar = <None>
''')),
        ('deprecated_reason',
         dict(opts=[('test', [(groups['foo'], [opts['deprecated_reason_opt']])
                              ])],
              expected='''[DEFAULT]


[foo]
# foo help

#
# From test
#

# DEPRECATED: Turn off stove (boolean value)
# This option is deprecated for removal.
# Its value may be silently ignored in the future.
# Reason: This was supposed to work but it really, really did not.
# Always buy house insurance.
#turn_off_stove = false
''')),
        ('deprecated_opt_with_deprecated_group',
         dict(opts=[('test', [
             (groups['foo'], [opts['deprecated_opt_with_deprecated_group']])
         ])],
              expected='''[DEFAULT]


[foo]
# foo help

#
# From test
#

# deprecated (string value)
# Deprecated group/name - [group1]/foobar
#bar = <None>
''')),
        ('unknown_type',
         dict(opts=[('test', [(None, [opts['unknown_type']])])],
              expected='''[DEFAULT]

#
# From test
#

# unknown (unknown type)
#unknown_opt = 123
''')),
        ('str_opt',
         dict(opts=[('test', [(None, [opts['str_opt']])])],
              expected='''[DEFAULT]

#
# From test
#

# a string (string value)
#str_opt = foo bar
''')),
        ('str_opt_with_space',
         dict(opts=[('test', [(None, [opts['str_opt_with_space']])])],
              expected='''[DEFAULT]

#
# From test
#

# a string with spaces (string value)
#str_opt = "  foo bar  "
''')),
        ('bool_opt',
         dict(opts=[('test', [(None, [opts['bool_opt']])])],
              expected='''[DEFAULT]

#
# From test
#

# a boolean (boolean value)
#bool_opt = false
''')),
        ('int_opt',
         dict(opts=[('test', [(None, [opts['int_opt']])])],
              expected='''[DEFAULT]

#
# From test
#

# an integer (integer value)
# Minimum value: 1
# Maximum value: 20
#int_opt = 10
''')),
        ('int_opt_min_0',
         dict(opts=[('test', [(None, [opts['int_opt_min_0']])])],
              expected='''[DEFAULT]

#
# From test
#

# an integer (integer value)
# Minimum value: 0
# Maximum value: 20
#int_opt_min_0 = 10
''')),
        ('int_opt_max_0',
         dict(opts=[('test', [(None, [opts['int_opt_max_0']])])],
              expected='''[DEFAULT]

#
# From test
#

# an integer (integer value)
# Maximum value: 0
#int_opt_max_0 = -1
''')),
        ('float_opt',
         dict(opts=[('test', [(None, [opts['float_opt']])])],
              expected='''[DEFAULT]

#
# From test
#

# a float (floating point value)
#float_opt = 0.1
''')),
        ('list_opt',
         dict(opts=[('test', [(None, [opts['list_opt']])])],
              expected='''[DEFAULT]

#
# From test
#

# a list (list value)
#list_opt = 1,2,3
''')),
        ('dict_opt',
         dict(opts=[('test', [(None, [opts['dict_opt']])])],
              expected='''[DEFAULT]

#
# From test
#

# a dict (dict value)
#dict_opt = 1:yes,2:no
''')),
        ('ip_opt',
         dict(opts=[('test', [(None, [opts['ip_opt']])])],
              expected='''[DEFAULT]

#
# From test
#

# an ip address (IP address value)
#ip_opt = 127.0.0.1
''')),
        ('port_opt',
         dict(opts=[('test', [(None, [opts['port_opt']])])],
              expected='''[DEFAULT]

#
# From test
#

# a port (port value)
# Minimum value: 0
# Maximum value: 65535
#port_opt = 80
''')),
        ('hostname_opt',
         dict(opts=[('test', [(None, [opts['hostname_opt']])])],
              expected='''[DEFAULT]

#
# From test
#

# a hostname (hostname value)
#hostname_opt = compute01.nova.site1
''')),
        ('multi_opt',
         dict(opts=[('test', [(None, [opts['multi_opt']])])],
              expected='''[DEFAULT]

#
# From test
#

# multiple strings (multi valued)
#multi_opt = 1
#multi_opt = 2
#multi_opt = 3
''')),
        ('multi_opt_none',
         dict(opts=[('test', [(None, [opts['multi_opt_none']])])],
              expected='''[DEFAULT]

#
# From test
#

# multiple strings (multi valued)
#multi_opt_none =
''')),
        ('multi_opt_empty',
         dict(opts=[('test', [(None, [opts['multi_opt_empty']])])],
              expected='''[DEFAULT]

#
# From test
#

# multiple strings (multi valued)
#multi_opt_empty =
''')),
        ('str_opt_sample_default',
         dict(opts=[('test', [(None, [opts['str_opt_sample_default']])])],
              expected='''[DEFAULT]

#
# From test
#

# a string (string value)
#str_opt = fooishbar
''')),
        ('native_str_type',
         dict(opts=[('test', [(None, [opts['native_str_type']])])],
              expected='''[DEFAULT]

#
# From test
#

# native help (string value)
#native_str_type = <None>
''')),
        ('native_int_type',
         dict(opts=[('test', [(None, [opts['native_int_type']])])],
              expected='''[DEFAULT]

#
# From test
#

# native help (integer value)
#native_int_type = <None>
''')),
        ('native_float_type',
         dict(opts=[('test', [(None, [opts['native_float_type']])])],
              expected='''[DEFAULT]

#
# From test
#

# native help (floating point value)
#native_float_type = <None>
''')),
        ('multi_opt_sample_default',
         dict(opts=[('test', [(None, [opts['multi_opt_sample_default']])])],
              expected='''[DEFAULT]

#
# From test
#

# multiple strings (multi valued)
#multi_opt = 5
#multi_opt = 6
''')),
        ('custom_type_name',
         dict(opts=[('test', [(None, [opts['custom_type_name']])])],
              expected='''[DEFAULT]

#
# From test
#

# this is a port (port number)
#custom_opt_type = 5511
''')),
        ('custom_type',
         dict(opts=[('test', [(None, [opts['custom_type']])])],
              expected='''[DEFAULT]

#
# From test
#

# custom help (unknown value)
#custom_type = <None>
''')),
        ('string_type_with_bad_default',
         dict(opts=[('test', [(None, [opts['string_type_with_bad_default']])])
                    ],
              expected='''[DEFAULT]

#
# From test
#

# string with bad default (string value)
#string_type_with_bad_default = 4096
''')),
        ('str_opt_str_group',
         dict(opts=[('test', [('foo', [opts['str_opt']]),
                              (groups['foo'], [opts['int_opt']])]),
                    ('foo', [('foo', [opts['bool_opt']])])],
              expected='''[DEFAULT]


[foo]
# foo help

#
# From foo
#

# a boolean (boolean value)
#bool_opt = false

#
# From test
#

# a string (string value)
#str_opt = foo bar

#
# From test
#

# an integer (integer value)
# Minimum value: 1
# Maximum value: 20
#int_opt = 10
''')),
        ('opt_str_opt_group',
         dict(opts=[('test', [(groups['foo'], [opts['int_opt']]),
                              ('foo', [opts['str_opt']])]),
                    ('foo', [(groups['foo'], [opts['bool_opt']])])],
              expected='''[DEFAULT]


[foo]
# foo help

#
# From foo
#

# a boolean (boolean value)
#bool_opt = false

#
# From test
#

# an integer (integer value)
# Minimum value: 1
# Maximum value: 20
#int_opt = 10

#
# From test
#

# a string (string value)
#str_opt = foo bar
''')),
        ('opt_with_DeprecatedOpt',
         dict(opts=[('test', [(None, [opts['opt_with_DeprecatedOpt']])])],
              expected='''[DEFAULT]

#
# From test
#

# Opt with DeprecatedOpt (boolean value)
# Deprecated group/name - [deprecated]/foo_bar
#foo_bar = <None>
''')),
    ]

    output_file_scenarios = [
        ('stdout', dict(stdout=True, output_file=None)),
        ('output_file', dict(output_file='sample.conf', stdout=False)),
    ]

    @classmethod
    def generate_scenarios(cls):
        cls.scenarios = testscenarios.multiply_scenarios(
            cls.content_scenarios, cls.output_file_scenarios)

    def setUp(self):
        super(GeneratorTestCase, self).setUp()

        self.conf = cfg.ConfigOpts()
        self.config_fixture = config_fixture.Config(self.conf)
        self.config = self.config_fixture.config
        self.useFixture(self.config_fixture)

        self.tempdir = self.useFixture(fixtures.TempDir())

    def _capture_stream(self, stream_name):
        self.useFixture(
            fixtures.MonkeyPatch("sys.%s" % stream_name, moves.StringIO()))
        return getattr(sys, stream_name)

    def _capture_stdout(self):
        return self._capture_stream('stdout')

    @mock.patch.object(generator, '_get_raw_opts_loaders')
    @mock.patch.object(generator, 'LOG')
    def test_generate(self, mock_log, raw_opts_loader):
        generator.register_cli_opts(self.conf)

        namespaces = [i[0] for i in self.opts]
        self.config(namespace=namespaces)

        for group in self.groups.values():
            self.conf.register_group(group)

        wrap_width = getattr(self, 'wrap_width', None)
        if wrap_width is not None:
            self.config(wrap_width=wrap_width)

        if self.stdout:
            stdout = self._capture_stdout()
        else:
            output_file = self.tempdir.join(self.output_file)
            self.config(output_file=output_file)

        # We have a static data structure matching what should be
        # returned by _list_opts() but we're mocking out a lower level
        # function that needs to return a namespace and a callable to
        # return options from that namespace. We have to pass opts to
        # the lambda to cache a reference to the name because the list
        # comprehension changes the thing pointed to by the name each
        # time through the loop.
        raw_opts_loader.return_value = [(ns, lambda opts=opts: opts)
                                        for ns, opts in self.opts]

        generator.generate(self.conf)

        if self.stdout:
            self.assertEqual(self.expected, stdout.getvalue())
        else:
            with open(output_file, 'r') as f:
                actual = f.read()
            self.assertEqual(self.expected, actual)

        log_warning = getattr(self, 'log_warning', None)
        if log_warning is not None:
            mock_log.warning.assert_called_once_with(*log_warning)
        else:
            self.assertFalse(mock_log.warning.called)
Example #25
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

_deprecated_group = 'drivers:storage:mongodb'


ssl_keyfile = cfg.StrOpt(
    'ssl_keyfile',
    deprecated_opts=[cfg.DeprecatedOpt(
        'ssl_keyfile',
        group=_deprecated_group), ],
    help='The private keyfile used to identify the local '
         'connection against mongod. If included with '
         'the ``certifle`` then only the ``ssl_certfile``'
         ' is needed.')


ssl_certfile = cfg.StrOpt(
    'ssl_certfile',
    deprecated_opts=[cfg.DeprecatedOpt(
        'ssl_certfile',
        group=_deprecated_group), ],
    help='The certificate file used to identify the '
         'local connection against mongod.')
Example #26
0
# 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.
"""Redis storage driver configuration options."""

from oslo_config import cfg

_deprecated_group = 'drivers:storage:redis'
# options common to management and message storage
_COMMON_REDIS_OPTIONS = (
    cfg.StrOpt('uri',
               default="redis://127.0.0.1:6379",
               deprecated_opts=[
                   cfg.DeprecatedOpt('uri', group=_deprecated_group),
               ],
               help=('Redis connection URI, taking one of three forms. '
                     'For a direct connection to a Redis server, use '
                     'the form "redis://[:password]@host[:port][?options]", '
                     'where password is redis-server\'s password, when'
                     'redis-server is set password, the password option'
                     'needs to be set. port defaults to 6379 if not'
                     'specified. For an HA master-slave Redis cluster using'
                     ' Redis Sentinel, use the form '
                     '"redis://[:password]@host1[:port1]'
                     '[,host2[:port2],...,hostN[:portN]][?options]", '
                     'where each host specified corresponds to an '
                     'instance of redis-sentinel. In this form, the '
                     'name of the Redis master used in the Sentinel '
                     'configuration must be included in the query '
Example #27
0
                    deprecated_name='notification_driver',
                    deprecated_group='DEFAULT',
                    help='The Drivers(s) to handle sending notifications. '
                         'Possible values are messaging, messagingv2, '
                         'routing, log, test, noop'),
    cfg.StrOpt('transport_url',
               deprecated_name='notification_transport_url',
               deprecated_group='DEFAULT',
               secret=True,
               help='A URL representing the messaging driver to use for '
                    'notifications. If not set, we fall back to the same '
                    'configuration used for RPC.'),
    cfg.ListOpt('topics',
                default=['notifications', ],
                deprecated_opts=[
                    cfg.DeprecatedOpt('topics',
                                      group='rpc_notifier2'),
                    cfg.DeprecatedOpt('notification_topics',
                                      group='DEFAULT')
                ],
                help='AMQP topic used for OpenStack notifications.'),
    cfg.IntOpt('retry', default=-1,
               help='The maximum number of attempts to re-send a notification '
                    'message which failed to be delivered due to a '
                    'recoverable error. 0 - No retry, -1 - indefinite'),
]

_LOG = logging.getLogger(__name__)


def _send_notification():
    """Command line tool to send notifications manually."""
Example #28
0
               default='public',
               choices=['public', 'admin', 'internal'],
               help='Type of the nova endpoint to use.  This endpoint will '
               'be looked up in the keystone catalog and should be '
               'one of public, internal or admin.'),
    cfg.StrOpt('token_auth_url',
               help='The authentication URL for the nova connection when '
               'using the current user'
               's token'),
]

NOVA_GROUP = 'nova'
CONF = cfg.CONF

deprecations = {
    'cafile': [cfg.DeprecatedOpt('nova_ca_certificates_file')],
    'insecure': [cfg.DeprecatedOpt('nova_api_insecure')]
}
nova_session_opts = ks_loading.get_session_conf_options(
    deprecated_opts=deprecations)
nova_auth_opts = ks_loading.get_auth_common_conf_options()

CONF.register_opts(old_opts)
CONF.register_opts(nova_opts, group=NOVA_GROUP)
CONF.register_opts(nova_session_opts, group=NOVA_GROUP)
CONF.register_opts(nova_auth_opts, group=NOVA_GROUP)

LOG = logging.getLogger(__name__)

NOVA_API_VERSION = "2.1"
Example #29
0
from rally.common.i18n import _
from rally.common import logging
from rally.common import objects
from rally.common import utils
from rally import exceptions
from rally import osclients
from rally.plugins.openstack.wrappers import glance
from rally.plugins.openstack.wrappers import network
from rally.task import utils as task_utils

LOG = logging.getLogger(__name__)

TEMPEST_OPTS = [
    cfg.StrOpt(
        "img_url",
        deprecated_opts=[cfg.DeprecatedOpt("cirros_img_url", group="image")],
        default="http://download.cirros-cloud.net/"
        "0.3.4/cirros-0.3.4-x86_64-disk.img",
        help="image URL"),
    cfg.StrOpt(
        "img_disk_format",
        deprecated_opts=[cfg.DeprecatedOpt("disk_format", group="image")],
        default="qcow2",
        help="Image disk format to use when creating the image"),
    cfg.StrOpt(
        "img_container_format",
        deprecated_opts=[cfg.DeprecatedOpt("container_format", group="image")],
        default="bare",
        help="Image container format to use when creating the image"),
    cfg.StrOpt(
        "img_name_regex",
Example #30
0
            help='Defines the maximum number of subscriptions per page.'),
 cfg.IntOpt('max_messages_per_claim_or_pop',
            default=20,
            deprecated_name='max_messages_per_claim',
            help='The maximum number of messages that can be claimed (OR) '
            'popped in a single request'),
 cfg.IntOpt('max_queue_metadata',
            default=64 * 1024,
            deprecated_name='metadata_size_uplimit',
            deprecated_group='limits:transport',
            help='Defines the maximum amount of metadata in a queue.'),
 cfg.IntOpt('max_messages_post_size',
            default=256 * 1024,
            deprecated_name='message_size_uplimit',
            deprecated_group='limits:transport',
            deprecated_opts=[cfg.DeprecatedOpt('max_message_size')],
            help='Defines the maximum size of message posts.'),
 cfg.IntOpt('max_message_ttl',
            default=1209600,
            deprecated_name='message_ttl_max',
            deprecated_group='limits:transport',
            help='Maximum amount of time a message will be available.'),
 cfg.IntOpt('max_claim_ttl',
            default=43200,
            deprecated_name='claim_ttl_max',
            deprecated_group='limits:transport',
            help='Maximum length of a message in claimed state.'),
 cfg.IntOpt('max_claim_grace',
            default=43200,
            deprecated_name='claim_grace_max',
            deprecated_group='limits:transport',