How to use the debtcollector.deprecate function in debtcollector

To help you get started, we’ve selected a few debtcollector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / designate / designate / cmd / zone_manager.py View on Github external
def main():
    utils.read_config('designate', sys.argv)
    logging.setup(CONF, 'designate')
    gmr.TextGuruMeditation.setup_autorun(version)

    # NOTE(timsim): This is to ensure people don't start the wrong
    #               services when the worker model is enabled.

    if CONF['service:worker'].enabled:
        LOG.error('You have designate-worker enabled, starting '
                  'designate-zone-manager is incompatible with '
                  'designate-worker. You need to start '
                  'designate-producer instead.')
        sys.exit(1)

    debtcollector.deprecate('designate-zone-manager Is deprecated in '
                            'favor of the designate-producer',
                            version='newton',
                            removal_version='rocky')

    LOG.warning('Starting designate-producer under the zone-manager name')

    server = producer_service.Service(
        threads=CONF['service:zone_manager'].threads)
    service.serve(server, workers=CONF['service:zone_manager'].workers)
    server.heartbeat_emitter.start()
    service.wait()
github openstack / murano / murano / dsl / murano_package.py View on Github external
except exceptions.NoClassFound:
                    if name.startswith('io.murano.extensions'):
                        try:
                            short_name = name.replace(
                                'io.murano.extensions.', '', 1)
                            result = referenced_package.find_class(
                                short_name, False)
                            warnings.simplefilter("once")
                            msg = ("Plugin %(name)s was not found, but a "
                                   "%(shorter_name)s was found instead and "
                                   "will be used. This could be caused by "
                                   "recent change in plugin naming scheme. If "
                                   "you are developing applications targeting "
                                   "this plugin consider changing its name" %
                                   {'name': name, 'shorter_name': short_name})
                            debtcollector.deprecate(msg)
                            return result
                        except exceptions.NoClassFound:
                            pass
                    pkgs_for_search.append(referenced_package)
                    continue
            raise exceptions.NoClassFound(
                name, packages=pkgs_for_search + [self])

        raise exceptions.NoClassFound(name, packages=[self])
github openstack / neutron / neutron / plugins / ml2 / drivers / openvswitch / agent / openflow / native / ofswitch.py View on Github external
def install_instructions(self, instructions,
                             table_id=0, priority=0,
                             match=None, active_bundle=None, **match_kwargs):
        (dp, ofp, ofpp) = self._get_dp()
        match = self._match(ofp, ofpp, match, **match_kwargs)
        if isinstance(instructions, six.string_types):
            debtcollector.deprecate("Use of string instruction is "
                "deprecated", removal_version='U')
            jsonlist = ofctl_string.ofp_instruction_from_str(
                ofp, instructions)
            instructions = ofproto_parser.ofp_instruction_from_jsondict(
                dp, jsonlist)
        msg = ofpp.OFPFlowMod(dp,
                              table_id=table_id,
                              cookie=self.default_cookie,
                              match=match,
                              priority=priority,
                              instructions=instructions)
        self._send_msg(msg, active_bundle=active_bundle)
github openstack / oslo.middleware / oslo_middleware / cors.py View on Github external
allow_headers=allow_headers)

        # If the default configuration contains an allowed_origin, don't
        # forget to register that.
        self.add_origin(allowed_origin=allowed_origin,
                        allow_credentials=allow_credentials,
                        expose_headers=expose_headers,
                        max_age=max_age,
                        allow_methods=allow_methods,
                        allow_headers=allow_headers)

        # Iterate through all the loaded config sections, looking for ones
        # prefixed with 'cors.'
        for section in self.oslo_conf.list_all_sections():
            if section.startswith('cors.'):
                debtcollector.deprecate('Multiple configuration blocks are '
                                        'deprecated and will be removed in '
                                        'future versions. Please consolidate '
                                        'your configuration in the [cors] '
                                        'configuration block.')
                # Register with the preconstructed defaults
                self.oslo_conf.register_opts(subgroup_opts, section)
                self.add_origin(**self.oslo_conf[section])
github openstack / oslo.context / oslo_context / context.py View on Github external
def _moved_msg(new_name, old_name):
    if old_name:
        deprecated_msg = "Property '%(old_name)s' has moved to '%(new_name)s'"
        deprecated_msg = deprecated_msg % {'old_name': old_name,
                                           'new_name': new_name}

        debtcollector.deprecate(deprecated_msg,
                                version='2.6',
                                removal_version='3.0',
                                stacklevel=5)
github openstack / neutron / neutron / agent / common / ovs_lib.py View on Github external
def run_ofctl(self, cmd, args, process_input=None):
        debtcollector.deprecate("Use of run_ofctl is "
            "deprecated", removal_version='V')
        full_args = ["ovs-ofctl", cmd,
                     "-O", self._highest_protocol_needed,
                     self.br_name] + args
        # TODO(kevinbenton): This error handling is really brittle and only
        # detects one specific type of failure. The callers of this need to
        # be refactored to expect errors so we can re-raise and they can
        # take appropriate action based on the type of error.
        for i in range(1, 11):
            try:
                return utils.execute(full_args, run_as_root=True,
                                     process_input=process_input)
            except Exception as e:
                if "failed to connect to socket" in str(e):
                    LOG.debug("Failed to connect to OVS. Retrying "
                              "in 1 second. Attempt: %s/10", i)
github openstack / oslo.messaging / oslo_messaging / _drivers / impl_pika.py View on Github external
def __init__(self, conf, url, default_exchange=None,
                 allowed_remote_exmods=None):

        deprecate("The pika driver is no longer maintained. It has been"
                  " deprecated",
                  message="It is recommended that all users of the pika driver"
                  " transition to using the rabbit driver.",
                  version="pike", removal_version="rocky")

        opt_group = cfg.OptGroup(name='oslo_messaging_pika',
                                 title='Pika driver options')
        conf.register_group(opt_group)
        conf.register_opts(pika_drv_conn_factory.pika_opts, group=opt_group)
        conf.register_opts(pika_pool_opts, group=opt_group)
        conf.register_opts(message_opts, group=opt_group)
        conf.register_opts(rpc_opts, group=opt_group)
        conf.register_opts(notification_opts, group=opt_group)
        conf = common.ConfigOptsProxy(conf, url, opt_group.name)

        self._pika_engine = pika_drv_engine.PikaEngine(