Ejemplo n.º 1
0
    def test_deprecated_message(self, mock_reporter):

        versionutils.deprecation_warning('outdated_stuff',
                                         as_of=versionutils.deprecated.KILO,
                                         in_favor_of='different_stuff',
                                         remove_in=+2)

        self.assert_deprecated(mock_reporter,
                               what='outdated_stuff',
                               in_favor_of='different_stuff',
                               as_of='Kilo',
                               remove_in='Mitaka')
Ejemplo n.º 2
0
    def test_deprecated_message(self, mock_reporter):

        versionutils.deprecation_warning('outdated_stuff',
                                         as_of=versionutils.deprecated.KILO,
                                         in_favor_of='different_stuff',
                                         remove_in=+2)

        self.assert_deprecated(mock_reporter,
                               what='outdated_stuff',
                               in_favor_of='different_stuff',
                               as_of='Kilo',
                               remove_in='Mitaka')
Ejemplo n.º 3
0
def run():
    if six.PY3:
        d = jsonutils.load(sys.stdin.buffer)
    else:
        d = jsonutils.load(sys.stdin)
    cni_conf = utils.CNIConfig(d)
    args = ['--config-file', cni_conf.kuryr_conf]

    try:
        if cni_conf.debug:
            args.append('-d')
    except AttributeError:
        pass
    config.init(args)
    config.setup_logging()

    # Initialize o.vo registry.
    k_objects.register_locally_defined_vifs()
    os_vif.initialize()

    if CONF.cni_daemon.daemon_enabled:
        runner = cni_api.CNIDaemonizedRunner()
    else:
        versionutils.deprecation_warning(
            'Deploying kuryr-kubernetes without kuryr-daemon service', 'R')
        runner = cni_api.CNIStandaloneRunner(k8s_cni.K8sCNIPlugin())
    LOG.info("Using '%s' ", runner.__class__.__name__)

    def _timeout(signum, frame):
        runner._write_dict(sys.stdout, {
            'msg': 'timeout',
            'code': k_const.CNI_TIMEOUT_CODE,
        })
        LOG.debug('timed out')
        sys.exit(1)

    signal.signal(signal.SIGALRM, _timeout)
    signal.alarm(_CNI_TIMEOUT)
    status = runner.run(os.environ, cni_conf, sys.stdout)
    LOG.debug("Exiting with status %s", status)
    if status:
        sys.exit(status)
Ejemplo n.º 4
0
def deprecate_warning(what, as_of, in_favor_of=None, remove_in=1):
    versionutils.deprecation_warning(as_of=as_of,
                                     what=what,
                                     in_favor_of=in_favor_of,
                                     remove_in=remove_in)
Ejemplo n.º 5
0
def log_deprecated_warning(deprecated_value, castellan):
    versionutils.deprecation_warning(deprecated_value,
                                     versionutils.deprecated.NEWTON,
                                     in_favor_of=castellan,
                                     logger=LOG)
Ejemplo n.º 6
0
def log_deprecated_warning(deprecated_value, castellan):
    versionutils.deprecation_warning(deprecated_value,
                                     versionutils.deprecated.NEWTON,
                                     in_favor_of=castellan, logger=LOG)