Exemplo n.º 1
0
class LoggingBase(moves.moved_class(DumpingListener,
                                    'LoggingBase', __name__,
                                    version="0.6", removal_version="?")):

    def _dump(self, message, *args, **kwargs):
        self._log(message, *args, **kwargs)

    @abc.abstractmethod
    def _log(self, message, *args, **kwargs):
        """Logs the provided *templated* message to some output."""
Exemplo n.º 2
0
class LoggingBase(
        moves.moved_class(DumpingListener,
                          'LoggingBase',
                          __name__,
                          version="0.6",
                          removal_version="2.0")):
    """Legacy logging base.

     .. deprecated:: 0.6

         This class is **deprecated** and is present for backward
         compatibility **only**, its replacement
         :py:class:`.DumpingListener` should be used going forward.
    """
    def _dump(self, message, *args, **kwargs):
        self._log(message, *args, **kwargs)

    @abc.abstractmethod
    def _log(self, message, *args, **kwargs):
        """Logs the provided *templated* message to some output."""
Exemplo n.º 3
0
# Copyright 2013 Red Hat, Inc.
#
#    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.

from debtcollector import moves

from neutron.agent.common import async_process


AsyncProcessException = moves.moved_class(
    async_process.AsyncProcessException,
    'AsyncProcessException',
    __name__)

AsyncProcess = moves.moved_class(
    async_process.AsyncProcess,
    'AsyncProcess',
    __name__)
Exemplo n.º 4
0
            # avoid reprocessing it
            updated_devices = ((updated_devices | devices_to_refilter) -
                               new_devices)
            if updated_devices:
                LOG.debug("Refreshing firewall for %d devices",
                          len(updated_devices))
                self.refresh_firewall(updated_devices)


# TODO(armax): For bw compat with external dependencies; to be dropped in P.
# NOTE(dasm): Should be already removed, but didn't have  DeprecationWarning.
SG_RPC_VERSION = moves.moved_function(
    securitygroups_rpc.SecurityGroupAgentRpcApiMixin.SG_RPC_VERSION,
    'SG_RPC_VERSION', __name__, version='Liberty', removal_version='Pike'
)
SecurityGroupServerRpcApi = moves.moved_class(
    securitygroups_rpc.SecurityGroupServerRpcApi,
    'SecurityGroupServerRpcApi', old_module_name=__name__, version='Liberty',
    removal_version='Pike'
)
SecurityGroupAgentRpcApiMixin = moves.moved_class(
    securitygroups_rpc.SecurityGroupAgentRpcApiMixin,
    'SecurityGroupAgentRpcApiMixin', old_module_name=__name__,
    version='Liberty', removal_version='Pike'
)
SecurityGroupAgentRpcCallbackMixin = moves.moved_class(
    securitygroups_rpc.SecurityGroupAgentRpcCallbackMixin,
    'SecurityGroupAgentRpcCallbackMixin', old_module_name=__name__,
    version='Liberty', removal_version='Pike'
)
Exemplo n.º 5
0
# Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import backups_client


BackupsClient = moves.moved_class(
    backups_client.BackupsClient, 'BackupsClient',
    __name__, version="Rocky", removal_version='?')
Exemplo n.º 6
0
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import snapshots_client

SnapshotsClient = moves.moved_class(snapshots_client.SnapshotsClient,
                                    'SnapshotsClient',
                                    __name__,
                                    version="Rocky",
                                    removal_version='?')
    @classmethod
    def yellow_wolf(cls):
        pass

    @removals.remove()
    @staticmethod
    def blue_giant():
        pass

    @removals.remove(category=PendingDeprecationWarning)
    @staticmethod
    def green_giant():
        pass


OldHotness = moves.moved_class(NewHotness, 'OldHotness', __name__)

OldHotness2 = moves.moved_class(NewHotness, 'OldHotness', __name__,
                                category=PendingDeprecationWarning)


class DeprecateAnythingTest(test_base.TestCase):
    def test_generation(self):
        with warnings.catch_warnings(record=True) as capture:
            warnings.simplefilter("always")
            debtcollector.deprecate("Its broken")
            debtcollector.deprecate("Its really broken")
        self.assertEqual(2, len(capture))


class MovedInheritableClassTest(test_base.TestCase):
Exemplo n.º 8
0
#         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.

import threading

from debtcollector import moves
from oslo_utils import timeutils
import six

# TODO(harlowja): Keep alias class... around until 2.0 is released.
StopWatch = moves.moved_class(timeutils.StopWatch, 'StopWatch', __name__,
                              version="1.15", removal_version="2.0")


class Timeout(object):
    """An object which represents a timeout.

    This object has the ability to be interrupted before the actual timeout
    is reached.
    """
    def __init__(self, value, event_factory=threading.Event):
        if value < 0:
            raise ValueError("Timeout value must be greater or"
                             " equal to zero and not '%s'" % (value))
        self._value = value
        self._event = event_factory()
Exemplo n.º 9
0
    @classmethod
    def yellow_wolf(cls):
        pass

    @removals.remove()
    @staticmethod
    def blue_giant():
        pass

    @removals.remove(category=PendingDeprecationWarning)
    @staticmethod
    def green_giant():
        pass


OldHotness = moves.moved_class(NewHotness, 'OldHotness', __name__)

OldHotness2 = moves.moved_class(NewHotness,
                                'OldHotness',
                                __name__,
                                category=PendingDeprecationWarning)


class DeprecateAnythingTest(test_base.TestCase):
    def test_generation(self):
        with warnings.catch_warnings(record=True) as capture:
            warnings.simplefilter("always")
            debtcollector.deprecate("Its broken")
            debtcollector.deprecate("Its really broken")
        self.assertEqual(2, len(capture))
Exemplo n.º 10
0
# Copyright 2016 Red Hat, Inc.
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import scheduler_stats_client


SchedulerStatsClient = moves.moved_class(
    scheduler_stats_client.SchedulerStatsClient, 'SchedulerStatsClient',
    __name__, version="Rocky", removal_version='?')
Exemplo n.º 11
0
# Copyright 2018 Rackspace, US Inc.
#
#    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.

import warnings

from debtcollector import moves

from octavia_lib.api.drivers import provider_base as lib_provider_base


warnings.simplefilter('default', DeprecationWarning)

ProviderDriver = moves.moved_class(
    lib_provider_base.ProviderDriver, 'ProviderDriver', __name__,
    version='Stein', removal_version='U')
Exemplo n.º 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 warnings

from debtcollector import moves

from octavia_lib.api.drivers import data_models as lib_data_models


warnings.simplefilter('default', DeprecationWarning)

BaseDataModel = moves.moved_class(lib_data_models.BaseDataModel,
                                  'BaseDataModel', __name__,
                                  version='Stein', removal_version='U')

UnsetType = moves.moved_class(lib_data_models.UnsetType, 'UnsetType', __name__,
                              version='Stein', removal_version='U')

LoadBalancer = moves.moved_class(lib_data_models.LoadBalancer, 'LoadBalancer',
                                 __name__, version='Stein',
                                 removal_version='U')

Listener = moves.moved_class(lib_data_models.Listener, 'Listener', __name__,
                             version='Stein', removal_version='U')

Pool = moves.moved_class(lib_data_models.Pool, 'Pool', __name__,
                         version='Stein', removal_version='U')
Exemplo n.º 13
0
    as support for ``getattr(context, 'session', None)``.


    """


class ContextNotRequestedError(AttributeError):
    """Error raised when requesting a not-setup enginefacade attribute.

    This applies to the ``session`` and ``connection`` attributes
    of a user-defined context and/or RequestContext object, when they
    are accessed *within* the scope of an enginefacade decorator
    or context manager, but the context has not requested that
    attribute (e.g. like "with enginefacade.connection.using(context)"
    and "context.session" is requested).

    """


class CantStartEngineError(Exception):
    """Error raised when the enginefacade cannot start up correctly."""


moves.moved_class(warning.NotSupportedWarning,
                  'NotSupportedWarning',
                  __name__, version='Stein')

moves.moved_class(warning.OsloDBDeprecationWarning,
                  'OsloDBDeprecationWarning',
                  __name__, version='Stein')
Exemplo n.º 14
0
# Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import services_client


ServicesClient = moves.moved_class(
    services_client.ServicesClient, 'ServicesClient',
    __name__, version="Rocky", removal_version='?')
Exemplo n.º 15
0
# Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import volume_manage_client


VolumeManageClient = moves.moved_class(
    volume_manage_client.VolumeManageClient, 'VolumeManageClient',
    __name__, version="Rocky", removal_version='?')
Exemplo n.º 16
0
# Copyright 2014 IBM Corp.
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import extensions_client


ExtensionsClient = moves.moved_class(
    extensions_client.ExtensionsClient, 'ExtensionsClient',
    __name__, version="Rocky", removal_version='?')
Exemplo n.º 17
0
    def __enter__(self):
        self.register()
        return self

    def __exit__(self, type, value, tb):
        try:
            self.deregister()
        except Exception:
            # Don't let deregistering throw exceptions
            LOG.warn("Failed deregistering listeners from engine %s",
                     self._engine, exc_info=True)


# TODO(harlowja): remove in 0.7 or later...
ListenerBase = moves.moved_class(Listener, 'ListenerBase', __name__,
                                 version="0.6", removal_version="?")


@six.add_metaclass(abc.ABCMeta)
class DumpingListener(Listener):
    """Abstract base class for dumping listeners.

    This provides a simple listener that can be attached to an engine which can
    be derived from to dump task and/or flow state transitions to some target
    backend.

    To implement your own dumping listener derive from this class and
    override the ``_dump`` method.
    """

    @abc.abstractmethod
Exemplo n.º 18
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 debtcollector import moves
from oslo_config import cfg
from ovs.db import idl
from ovsdbapp.backend.ovs_idl import connection as _connection
from ovsdbapp.backend.ovs_idl import idlutils
import tenacity

from neutron.agent.ovsdb.native import helpers

TransactionQueue = moves.moved_class(_connection.TransactionQueue,
                                     'TransactionQueue', __name__)
Connection = moves.moved_class(_connection.Connection, 'Connection', __name__)


def idl_factory():
    conn = cfg.CONF.OVS.ovsdb_connection
    schema_name = 'Open_vSwitch'
    try:
        helper = idlutils.get_schema_helper(conn, schema_name)
    except Exception:
        helpers.enable_connection_uri(conn)

        @tenacity.retry(wait=tenacity.wait_exponential(multiplier=0.01),
                        stop=tenacity.stop_after_delay(1),
                        reraise=True)
        def do_get_schema_helper():
Exemplo n.º 19
0
# Copyright 2016 Red Hat, Inc.
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import limits_client


LimitsClient = moves.moved_class(
    limits_client.LimitsClient, 'LimitsClient',
    __name__, version="Rocky", removal_version='?')
Exemplo n.º 20
0
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import qos_client


QosSpecsClient = moves.moved_class(
    qos_client.QosSpecsClient, 'QosSpecsClient',
    __name__, version="Rocky", removal_version='?')
Exemplo n.º 21
0
long_message = """[WARNING]
ara.callback has been moved to ara.plugins.callbacks in ARA 0.9.2.
Please update your Ansible Callback Plugins path to include
    <path>/ara/plugins/callbacks
instead of:
    <path>/ara/callback
<path>/ara/callback will be removed in a future version.
For more details, please refer to the latest available documentation."""

message = 'ara.callback has been moved to ara.plugins.callbacks'

print(long_message)

CommitAfter = moves.moved_class(log_ara.CommitAfter,
                                'CommitAfter',
                                'ara',
                                version='0.9.2',
                                removal_version='?',
                                message=message)

IncludeResult = moves.moved_class(log_ara.IncludeResult,
                                  'IncludeResult',
                                  'ara',
                                  version='0.9.2',
                                  removal_version='?',
                                  message=message)

CallbackModule = moves.moved_class(log_ara.CallbackModule,
                                   'CallbackModule',
                                   'ara',
                                   version='0.9.2',
                                   removal_version='?',
Exemplo n.º 22
0
# Copyright 2016 Andrew Kerr
# All Rights Reserved.
#
#    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.

from debtcollector import moves

from tempest.lib.services.volume import base_client

BaseClient = moves.moved_class(base_client.BaseClient,
                               'BaseClient',
                               __name__,
                               version="Pike",
                               removal_version='?')
BaseClient.api_version = 'v3'
    @removals.remove()
    def black_tristars(self):
        pass

    @removals.remove()
    @classmethod
    def white_wolf(cls):
        pass

    @removals.remove()
    @staticmethod
    def blue_giant():
        pass


OldHotness = moves.moved_class(NewHotness, 'OldHotness', __name__)


class MovedInheritableClassTest(test_base.TestCase):
    def test_basics(self):
        old = OldHotness()
        self.assertIsInstance(old, NewHotness)
        self.assertEqual('cold', old.hot())

    def test_warnings_emitted_creation(self):
        with warnings.catch_warnings(record=True) as capture:
            warnings.simplefilter("always")
            OldHotness()
        self.assertEqual(1, len(capture))
        w = capture[0]
        self.assertEqual(DeprecationWarning, w.category)
Exemplo n.º 24
0
                help='Drop notifications if no event definition matches. '
                '(Otherwise, we convert them with just the default traits)'),
    cfg.MultiStrOpt('store_raw',
                    default=[],
                    help='Store the raw notification for select priority '
                    'levels (info and/or error). By default, raw details are '
                    'not captured.')
]

cfg.CONF.register_opts(OPTS, group='event')

LOG = log.getLogger(__name__)

EventDefinitionException = moves.moved_class(declarative.DefinitionException,
                                             'EventDefinitionException',
                                             __name__,
                                             version=6.0,
                                             removal_version="?")


class TraitDefinition(declarative.Definition):
    def __init__(self, name, trait_cfg, plugin_manager):
        super(TraitDefinition, self).__init__(name, trait_cfg, plugin_manager)
        type_name = (trait_cfg.get('type', 'text') if isinstance(
            trait_cfg, dict) else 'text')
        self.trait_type = models.Trait.get_type_by_name(type_name)
        if self.trait_type is None:
            raise declarative.DefinitionException(
                _("Invalid trait type '%(type)s' for trait %(trait)s") %
                dict(type=type_name, trait=name), self.cfg)
Exemplo n.º 25
0
    def _task_receiver(self, state, details):
        task_name = details['task_name']
        if state == states.PENDING:
            self._timers.pop(task_name, None)
        elif state in STARTING_STATES:
            self._timers[task_name] = tt.StopWatch().start()
        elif state in FINISHED_STATES:
            timer = self._timers.pop(task_name, None)
            if timer is not None:
                timer.stop()
                self._record_ending(timer, task_name)


TimingListener = moves.moved_class(DurationListener,
                                   'TimingListener',
                                   __name__,
                                   version="0.8",
                                   removal_version="?")


class PrintingDurationListener(DurationListener):
    """Listener that prints the duration as well as recording it."""
    def __init__(self, engine, printer=None):
        super(PrintingDurationListener, self).__init__(engine)
        if printer is None:
            self._printer = _printer
        else:
            self._printer = printer

    def _record_ending(self, timer, task_name):
        super(PrintingDurationListener, self)._record_ending(timer, task_name)
Exemplo n.º 26
0
            # avoid reprocessing it
            updated_devices = ((updated_devices | devices_to_refilter) -
                               new_devices)
            if updated_devices:
                LOG.debug("Refreshing firewall for %d devices",
                          len(updated_devices))
                self.refresh_firewall(updated_devices)


# TODO(armax): For bw compat with external dependencies; to be dropped in P.
# NOTE(dasm): Should be already removed, but didn't have  DeprecationWarning.
SG_RPC_VERSION = moves.moved_function(
    securitygroups_rpc.SecurityGroupAgentRpcApiMixin.SG_RPC_VERSION,
    'SG_RPC_VERSION', __name__, version='Liberty', removal_version='Pike'
)
SecurityGroupServerRpcApi = moves.moved_class(
    securitygroups_rpc.SecurityGroupServerRpcApi,
    'SecurityGroupServerRpcApi', old_module_name=__name__, version='Liberty',
    removal_version='Pike'
)
SecurityGroupAgentRpcApiMixin = moves.moved_class(
    securitygroups_rpc.SecurityGroupAgentRpcApiMixin,
    'SecurityGroupAgentRpcApiMixin', old_module_name=__name__,
    version='Liberty', removal_version='Pike'
)
SecurityGroupAgentRpcCallbackMixin = moves.moved_class(
    securitygroups_rpc.SecurityGroupAgentRpcCallbackMixin,
    'SecurityGroupAgentRpcCallbackMixin', old_module_name=__name__,
    version='Liberty', removal_version='Pike'
)
Exemplo n.º 27
0
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import qos_client

QosSpecsClient = moves.moved_class(qos_client.QosSpecsClient,
                                   'QosSpecsClient',
                                   __name__,
                                   version="Rocky",
                                   removal_version='?')
Exemplo n.º 28
0
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import types_client


TypesClient = moves.moved_class(
    types_client.TypesClient, 'TypesClient',
    __name__, version="Rocky", removal_version='?')
Exemplo n.º 29
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 warnings

from debtcollector import moves

from octavia_lib.api.drivers import exceptions as lib_exceptions

warnings.simplefilter('default', DeprecationWarning)

DriverError = moves.moved_class(lib_exceptions.DriverError,
                                'DriverError',
                                __name__,
                                version='Stein',
                                removal_version='U')

NotImplementedError = moves.moved_class(lib_exceptions.NotImplementedError,
                                        'NotImplementedError',
                                        __name__,
                                        version='Stein',
                                        removal_version='U')

UnsupportedOptionError = moves.moved_class(
    lib_exceptions.UnsupportedOptionError,
    'UnsupportedOptionError',
    __name__,
    version='Stein',
    removal_version='U')
Exemplo n.º 30
0
# Copyright 2016 Red Hat, Inc.
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import snapshot_manage_client


SnapshotManageClient = moves.moved_class(
    snapshot_manage_client.SnapshotManageClient, 'SnapshotManageClient',
    __name__, version="Rocky", removal_version='?')
Exemplo n.º 31
0
# Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import quota_classes_client


QuotaClassesClient = moves.moved_class(
    quota_classes_client.QuotaClassesClient, 'QuotaClassesClient',
    __name__, version="Rocky", removal_version='?')
Exemplo n.º 32
0
    cfg.StrOpt('meter_definitions_cfg_file',
               default="meters.yaml",
               help="Configuration file for defining meter notifications."
               ),
]

cfg.CONF.register_opts(OPTS, group='meter')
cfg.CONF.import_opt('disable_non_metric_meters', 'ceilometer.notification',
                    group='notification')

LOG = log.getLogger(__name__)


MeterDefinitionException = moves.moved_class(declarative.DefinitionException,
                                             'MeterDefinitionException',
                                             __name__,
                                             version=6.0,
                                             removal_version="?")


class MeterDefinition(object):

    SAMPLE_ATTRIBUTES = ["name", "type", "volume", "unit", "timestamp",
                         "user_id", "project_id", "resource_id"]

    REQUIRED_FIELDS = ['name', 'type', 'event_type', 'unit', 'volume',
                       'resource_id']

    def __init__(self, definition_cfg, plugin_manager):
        self.cfg = definition_cfg
        missing = [field for field in self.REQUIRED_FIELDS
Exemplo n.º 33
0
    ),
    cfg.MultiStrOpt(
        "store_raw",
        default=[],
        help="Store the raw notification for select priority "
        "levels (info and/or error). By default, raw details are "
        "not captured.",
    ),
]

cfg.CONF.register_opts(OPTS, group="event")

LOG = log.getLogger(__name__)

EventDefinitionException = moves.moved_class(
    declarative.DefinitionException, "EventDefinitionException", __name__, version=6.0, removal_version="?"
)


class TraitDefinition(declarative.Definition):
    def __init__(self, name, trait_cfg, plugin_manager):
        super(TraitDefinition, self).__init__(name, trait_cfg, plugin_manager)
        type_name = trait_cfg.get("type", "text") if isinstance(trait_cfg, dict) else "text"
        self.trait_type = models.Trait.get_type_by_name(type_name)
        if self.trait_type is None:
            raise declarative.DefinitionException(
                _("Invalid trait type '%(type)s' for trait %(trait)s") % dict(type=type_name, trait=name), self.cfg
            )

    def to_trait(self, notification_body):
        value = self.parse(notification_body)
Exemplo n.º 34
0
#    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 collections
import uuid

from debtcollector import moves
from oslo_config import cfg
from oslo_utils import importutils
from ovsdbapp import api
from ovsdbapp import exceptions

from neutron._i18n import _

API = moves.moved_class(api.API, 'API', __name__)
Command = moves.moved_class(api.Command, 'Command', __name__)
Transaction = moves.moved_class(api.Transaction, 'Transaction', __name__)
TimeoutException = moves.moved_class(exceptions.TimeoutException,
                                     'TimeoutException', __name__)

interface_map = {
    'vsctl': 'neutron.agent.ovsdb.impl_vsctl',
    'native': 'neutron.agent.ovsdb.impl_idl',
}

OPTS = [
    cfg.StrOpt('ovsdb_interface',
               choices=interface_map.keys(),
               default='native',
               help=_('The interface for interacting with the OVSDB')),
Exemplo n.º 35
0
#    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.

from debtcollector import moves
from hyperv.neutron import security_groups_driver as sg_driver
from oslo_log import log as logging

from neutron._i18n import _LW

LOG = logging.getLogger(__name__)

# TODO(claudiub): Remove this module at the beginning of the O cycle.

new_driver = 'hyperv.neutron.security_groups_driver.HyperVSecurityGroupsDriver'
LOG.warn(_LW("You are using the deprecated firewall driver: %(deprecated)s. "
             "Use the recommended driver %(new)s instead."),
         {'deprecated': '%s.HyperVSecurityGroupsDriver' % __name__,
          'new': new_driver})

HyperVSecurityGroupsDriver = moves.moved_class(
    sg_driver.HyperVSecurityGroupsDriver,
    'HyperVSecurityGroupsDriver', __name__)
Exemplo n.º 36
0
    @removals.remove()
    def black_tristars(self):
        pass

    @removals.remove()
    @classmethod
    def white_wolf(cls):
        pass

    @removals.remove()
    @staticmethod
    def blue_giant():
        pass


OldHotness = moves.moved_class(NewHotness, 'OldHotness', __name__)


class MovedInheritableClassTest(test_base.TestCase):
    def test_basics(self):
        old = OldHotness()
        self.assertIsInstance(old, NewHotness)
        self.assertEqual('cold', old.hot())

    def test_warnings_emitted_creation(self):
        with warnings.catch_warnings(record=True) as capture:
            warnings.simplefilter("always")
            OldHotness()
        self.assertEqual(1, len(capture))
        w = capture[0]
        self.assertEqual(DeprecationWarning, w.category)
Exemplo n.º 37
0
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import transfers_client

TransfersClient = moves.moved_class(transfers_client.TransfersClient,
                                    'TransfersClient',
                                    __name__,
                                    version="Rocky",
                                    removal_version='?')
Exemplo n.º 38
0
from debtcollector import moves
from oslo_config import cfg
from ovsdbapp.backend.ovs_idl import command
from ovsdbapp.backend.ovs_idl import connection
from ovsdbapp.backend.ovs_idl import idlutils
from ovsdbapp.backend.ovs_idl import transaction
from ovsdbapp.backend.ovs_idl import vlog
from ovsdbapp.schema.open_vswitch import impl_idl

from neutron.agent.ovsdb.native import connection as n_connection
from neutron.conf.agent import ovs_conf
from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants

NeutronOVSDBTransaction = moves.moved_class(
    impl_idl.OvsVsctlTransaction,
    'NeutronOVSDBTransaction',
    __name__)

VswitchdInterfaceAddException = moves.moved_class(
    impl_idl.VswitchdInterfaceAddException,
    'VswitchdInterfaceAddException',
    __name__)

Transaction = moves.moved_class(transaction.Transaction,
                                'Transaction', __name__)

ovs_conf.register_ovs_agent_opts()
_connection = None


def api_factory(context):
Exemplo n.º 39
0
#    Copyright (C) 2015 Yahoo! Inc. All Rights Reserved.
#
#    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.

from debtcollector import moves
from debtcollector import removals

from taskflow.conductors.backends import impl_blocking

# TODO(harlowja): remove this module soon...
removals.removed_module(__name__,
                        replacement="the conductor entrypoints",
                        version="0.8", removal_version="?",
                        stacklevel=4)

# TODO(harlowja): remove this proxy/legacy class soon...
SingleThreadedConductor = moves.moved_class(
    impl_blocking.BlockingConductor, 'SingleThreadedConductor',
    __name__, version="0.8", removal_version="?")
Exemplo n.º 40
0
        """

    @abc.abstractmethod
    def validate(self):
        """Performs any pre-run, post-prepare validation actions.

        NOTE(harlowja): During validation all final dependencies
        will be verified and ensured. This will by default check that all
        atoms have satisfiable requirements (satisfied by some other
        provider).
        """

    @abc.abstractmethod
    def run(self):
        """Runs the flow in the engine to completion (or die trying)."""

    @abc.abstractmethod
    def suspend(self):
        """Attempts to suspend the engine.

        If the engine is currently running atoms then this will attempt to
        suspend future work from being started (currently active atoms can
        not currently be preempted) and move the engine into a suspend state
        which can then later be resumed from.
        """


# TODO(harlowja): remove in 0.7 or later...
EngineBase = moves.moved_class(Engine, 'EngineBase', __name__,
                               version="0.6", removal_version="?")
Exemplo n.º 41
0
# Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import services_client

ServicesClient = moves.moved_class(services_client.ServicesClient,
                                   'ServicesClient',
                                   __name__,
                                   version="Rocky",
                                   removal_version='?')
Exemplo n.º 42
0
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
#    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.

from debtcollector import moves

from tempest.lib.services.volume.v3 import encryption_types_client

EncryptionTypesClient = moves.moved_class(
    encryption_types_client.EncryptionTypesClient,
    'EncryptionTypesClient',
    __name__,
    version="Rocky",
    removal_version='?')
Exemplo n.º 43
0
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
#    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.
from debtcollector import moves

from tempest.lib.services.volume.v3 import volumes_client

VolumesClient = moves.moved_class(volumes_client.VolumesClient,
                                  'VolumesClient',
                                  __name__,
                                  version="Rocky",
                                  removal_version='?')
Exemplo n.º 44
0
from debtcollector import moves
from oslo_config import cfg
from ovs.db import idl
from ovs.stream import Stream
from ovsdbapp.backend.ovs_idl import connection as _connection
from ovsdbapp.backend.ovs_idl import event as idl_event
from ovsdbapp.backend.ovs_idl import idlutils
from ovsdbapp import event as ovsdb_event
import tenacity

from neutron.agent.ovsdb.native import exceptions as ovsdb_exc
from neutron.agent.ovsdb.native import helpers
from neutron.conf.agent import ovsdb_api

TransactionQueue = moves.moved_class(_connection.TransactionQueue,
                                     'TransactionQueue', __name__)
Connection = moves.moved_class(_connection.Connection, 'Connection', __name__)
LOG = logging.getLogger(__name__)

ovsdb_api.register_ovsdb_api_opts()


def configure_ssl_conn():
    """Configures required settings for an SSL based OVSDB client connection

    :return: None
    """

    req_ssl_opts = {
        'ssl_key_file': cfg.CONF.OVS.ssl_key_file,
        'ssl_cert_file': cfg.CONF.OVS.ssl_cert_file,
Exemplo n.º 45
0
# Copyright 2014 IBM Corp.
# All Rights Reserved.
#
#    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.

from debtcollector import moves

from tempest.lib.services.volume.v3 import availability_zone_client


AvailabilityZoneClient = moves.moved_class(
    availability_zone_client.AvailabilityZoneClient, 'AvailabilityZoneClient',
    __name__, version="Rocky", removal_version='?')
Exemplo n.º 46
0
from debtcollector import moves
from oslo_config import cfg
from ovsdbapp.backend.ovs_idl import command
from ovsdbapp.backend.ovs_idl import connection
from ovsdbapp.backend.ovs_idl import idlutils
from ovsdbapp.backend.ovs_idl import transaction
from ovsdbapp.backend.ovs_idl import vlog
from ovsdbapp.schema.open_vswitch import impl_idl

from neutron.agent.ovsdb.native import connection as n_connection
from neutron.conf.agent import ovs_conf
from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants

NeutronOVSDBTransaction = moves.moved_class(impl_idl.OvsVsctlTransaction,
                                            'NeutronOVSDBTransaction',
                                            __name__)

VswitchdInterfaceAddException = moves.moved_class(
    impl_idl.VswitchdInterfaceAddException, 'VswitchdInterfaceAddException',
    __name__)

Transaction = moves.moved_class(transaction.Transaction, 'Transaction',
                                __name__)

ovs_conf.register_ovs_agent_opts()
_connection = None


def api_factory(context):
    global _connection
Exemplo n.º 47
0
from neutron_lib.api.definitions import constants as api_const
from neutron_lib.api.definitions import firewall
from neutron_lib.api import extensions
from neutron_lib.exceptions import firewall_v1 as f_exc
from neutron_lib.services import base as service_base
from oslo_config import cfg
from oslo_log import log as logging
import six

from neutron_fwaas._i18n import _
from neutron_fwaas.common import fwaas_constants


LOG = logging.getLogger(__name__)

FirewallNotFound = moves.moved_class(
    f_exc.FirewallNotFound, 'FirewallNotFound', __name__)
FirewallInUse = moves.moved_class(
    f_exc.FirewallInUse, 'FirewallInUse', __name__)
FirewallPolicyNotFound = moves.moved_class(
    f_exc.FirewallPolicyNotFound, 'FirewallPolicyNotFound', __name__)
FirewallPolicyInUse = moves.moved_class(
    f_exc.FirewallPolicyInUse, 'FirewallPolicyInUse', __name__)
FirewallPolicyConflict = moves.moved_class(
    f_exc.FirewallPolicyConflict, 'FirewallPolicyConflict', __name__)
FirewallRuleSharingConflict = moves.moved_class(
    f_exc.FirewallRuleSharingConflict, 'FirewallRuleSharingConflict', __name__)
FirewallPolicySharingConflict = moves.moved_class(
    f_exc.FirewallPolicySharingConflict, 'FirewallPolicySharingConflict',
    __name__)
FirewallRuleNotFound = moves.moved_class(
    f_exc.FirewallRuleNotFound, 'FirewallRuleNotFound', __name__)
Exemplo n.º 48
0
from neutron_lib.api import validators
from neutron_lib import constants
from neutron_lib.db import constants as db_const
from neutron_lib.exceptions import firewall_v1 as f_exc
from neutron_lib.services import base as service_base
from oslo_config import cfg
from oslo_log import log as logging
import six

from neutron_fwaas._i18n import _
from neutron_fwaas.common import fwaas_constants


LOG = logging.getLogger(__name__)

FirewallNotFound = moves.moved_class(
    f_exc.FirewallNotFound, 'FirewallNotFound', __name__)
FirewallInUse = moves.moved_class(
    f_exc.FirewallInUse, 'FirewallInUse', __name__)
FirewallPolicyNotFound = moves.moved_class(
    f_exc.FirewallPolicyNotFound, 'FirewallPolicyNotFound', __name__)
FirewallPolicyInUse = moves.moved_class(
    f_exc.FirewallPolicyInUse, 'FirewallPolicyInUse', __name__)
FirewallPolicyConflict = moves.moved_class(
    f_exc.FirewallPolicyConflict, 'FirewallPolicyConflict', __name__)
FirewallRuleSharingConflict = moves.moved_class(
    f_exc.FirewallRuleSharingConflict, 'FirewallRuleSharingConflict', __name__)
FirewallPolicySharingConflict = moves.moved_class(
    f_exc.FirewallPolicySharingConflict, 'FirewallPolicySharingConflict',
    __name__)
FirewallRuleNotFound = moves.moved_class(
    f_exc.FirewallRuleNotFound, 'FirewallRuleNotFound', __name__)
Exemplo n.º 49
0
#    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 collections
import uuid

from debtcollector import moves
from oslo_config import cfg
from oslo_utils import importutils
from ovsdbapp import api
from ovsdbapp import exceptions

from neutron.conf.agent import ovsdb_api

API = moves.moved_class(api.API, 'API', __name__)
Command = moves.moved_class(api.Command, 'Command', __name__)
Transaction = moves.moved_class(api.Transaction, 'Transaction', __name__)
TimeoutException = moves.moved_class(exceptions.TimeoutException,
                                     'TimeoutException', __name__)


ovsdb_api.register_ovsdb_api_opts()


def from_config(context, iface_name=None):
    """Return the configured OVSDB API implementation"""
    iface = importutils.import_module(
        ovsdb_api.interface_map[iface_name or cfg.CONF.OVS.ovsdb_interface])
    return iface.api_factory(context)
Exemplo n.º 50
0
        self._receiver(co.FLOW, flow_name, state)

    def _receiver(self, item_type, item_name, state):
        if state == states.PENDING:
            self._timers[item_type].pop(item_name, None)
        elif state in STARTING_STATES:
            self._timers[item_type][item_name] = timeutils.StopWatch().start()
        elif state in FINISHED_STATES:
            timer = self._timers[item_type].pop(item_name, None)
            if timer is not None:
                timer.stop()
                self._record_ending(timer, item_type, item_name, state)


TimingListener = moves.moved_class(DurationListener,
                                   'TimingListener', __name__,
                                   version="0.8", removal_version="2.0")


class PrintingDurationListener(DurationListener):
    """Listener that prints the duration as well as recording it."""

    def __init__(self, engine, printer=None):
        super(PrintingDurationListener, self).__init__(engine)
        if printer is None:
            self._printer = _printer
        else:
            self._printer = printer

    def _record_ending(self, timer, item_type, item_name, state):
        super(PrintingDurationListener, self)._record_ending(
Exemplo n.º 51
0
#   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.

from ara.cli import generate
from debtcollector import moves

long_message = """[WARNING]
The "ara generate" command is deprecated and has been moved to
"ara generate html" command in ARA 0.10.6.

Please use the "ara generate html" command instead.
"ara generate" will be removed in a future version.
"""

message = '"ara generate" command has been moved to "ara generate html".'

print(long_message)

Generate = moves.moved_class(generate.GenerateHtml, 'GenerateHtml',
                             'ara',
                             version='0.10.6',
                             removal_version='?',
                             message=message)
Exemplo n.º 52
0
# Copyright 2018 Rackspace, US Inc.
#
#    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.

import warnings

from debtcollector import moves

from octavia_lib.api.drivers import provider_base as lib_provider_base

warnings.simplefilter('default', DeprecationWarning)

ProviderDriver = moves.moved_class(lib_provider_base.ProviderDriver,
                                   'ProviderDriver',
                                   __name__,
                                   version='Stein',
                                   removal_version='U')
Exemplo n.º 53
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.

import threading

from debtcollector import moves
from oslo_utils import timeutils
import six

# TODO(harlowja): Keep alias class... around until 2.0 is released.
StopWatch = moves.moved_class(timeutils.StopWatch,
                              'StopWatch',
                              __name__,
                              version="1.15",
                              removal_version="2.0")


class Timeout(object):
    """An object which represents a timeout.

    This object has the ability to be interrupted before the actual timeout
    is reached.
    """
    def __init__(self, value, event_factory=threading.Event):
        if value < 0:
            raise ValueError("Timeout value must be greater or"
                             " equal to zero and not '%s'" % (value))
        self._value = value
Exemplo n.º 54
0
#
#         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.

from debtcollector import moves
from hyperv.neutron import security_groups_driver as sg_driver
from oslo_log import log as logging

from neutron.i18n import _LW

LOG = logging.getLogger(__name__)

# TODO(claudiub): Remove this module at the beginning of the O cycle.

new_driver = 'hyperv.neutron.security_groups_driver.HyperVSecurityGroupsDriver'
LOG.warn(
    _LW("You are using the deprecated firewall driver: %(deprecated)s. "
        "Use the recommended driver %(new)s instead."), {
            'deprecated': '%s.HyperVSecurityGroupsDriver' % __name__,
            'new': new_driver
        })

HyperVSecurityGroupsDriver = moves.moved_class(
    sg_driver.HyperVSecurityGroupsDriver, 'HyperVSecurityGroupsDriver',
    __name__)
Exemplo n.º 55
0
# Copyright 2016 Red Hat, Inc.
# All Rights Reserved.
#
#    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.

from debtcollector import moves

from tempest.lib.services.volume.v3 import capabilities_client


CapabilitiesClient = moves.moved_class(
    capabilities_client.CapabilitiesClient, 'CapabilitiesClient',
    __name__, version="Queens", removal_version='?')