Browse Source

Remove redundant ctor super calls, add missing

Change-Id: Iad10fe2d520a056a66bda85951c02d80f49020a4
changes/23/464323/1
Yuval Brik 4 years ago
parent
commit
dca5ff046a
53 changed files with 62 additions and 98 deletions
  1. +0
    -4
      karbor/api/v1/plans.py
  2. +0
    -4
      karbor/api/v1/protectables.py
  3. +0
    -8
      karbor/api/v1/providers.py
  4. +0
    -4
      karbor/api/v1/restores.py
  5. +0
    -9
      karbor/cmd/manage.py
  6. +1
    -0
      karbor/loadables.py
  7. +1
    -0
      karbor/rpc.py
  8. +2
    -0
      karbor/service.py
  9. +1
    -0
      karbor/services/operationengine/engine/executors/base.py
  10. +0
    -3
      karbor/services/operationengine/engine/executors/scheduled_operation_executor.py
  11. +1
    -0
      karbor/services/operationengine/engine/triggers/timetrigger/time_trigger.py
  12. +1
    -0
      karbor/services/operationengine/engine/triggers/timetrigger/timeformats/crontab_time.py
  13. +1
    -0
      karbor/services/operationengine/operation_manager.py
  14. +1
    -0
      karbor/services/operationengine/operations/base.py
  15. +0
    -3
      karbor/services/operationengine/operations/protect_operation.py
  16. +1
    -0
      karbor/services/operationengine/user_trust_manager.py
  17. +3
    -0
      karbor/services/protection/bank_plugin.py
  18. +1
    -0
      karbor/services/protection/checkpoint.py
  19. +0
    -6
      karbor/services/protection/flows/delete.py
  20. +0
    -6
      karbor/services/protection/flows/protect.py
  21. +0
    -16
      karbor/services/protection/flows/restore.py
  22. +1
    -0
      karbor/services/protection/flows/worker.py
  23. +0
    -3
      karbor/services/protection/flows/workflow.py
  24. +1
    -0
      karbor/services/protection/graph.py
  25. +1
    -0
      karbor/services/protection/protectable_plugin.py
  26. +1
    -0
      karbor/services/protection/protectable_registry.py
  27. +1
    -3
      karbor/services/protection/protection_plugin.py
  28. +1
    -3
      karbor/services/protection/protection_plugins/image/image_protection_plugin.py
  29. +0
    -6
      karbor/services/protection/protection_plugins/noop_plugin.py
  30. +0
    -12
      karbor/services/protection/protection_plugins/server/nova_protection_plugin.py
  31. +0
    -3
      karbor/services/protection/protection_plugins/volume/cinder_protection_plugin.py
  32. +2
    -0
      karbor/services/protection/restore_heat.py
  33. +1
    -0
      karbor/tests/base.py
  34. +1
    -0
      karbor/tests/fullstack/karbor_base.py
  35. +8
    -0
      karbor/tests/fullstack/karbor_objects.py
  36. +1
    -0
      karbor/tests/unit/api/v1/test_scheduled_operation.py
  37. +2
    -0
      karbor/tests/unit/clients/test_eisoo.py
  38. +1
    -0
      karbor/tests/unit/objects/test_scheduled_operation_state.py
  39. +1
    -0
      karbor/tests/unit/operationengine/engine/executors/test_green_thread_executor.py
  40. +2
    -0
      karbor/tests/unit/operationengine/engine/triggers/test_trigger_manager.py
  41. +2
    -1
      karbor/tests/unit/operationengine/engine/triggers/timetrigger/test_time_trigger.py
  42. +1
    -0
      karbor/tests/unit/operationengine/operations/test_protect_operation.py
  43. +1
    -0
      karbor/tests/unit/operationengine/test_manager.py
  44. +1
    -0
      karbor/tests/unit/protection/fake_clients.py
  45. +2
    -1
      karbor/tests/unit/protection/fake_swift_client.py
  46. +2
    -3
      karbor/tests/unit/protection/fakes.py
  47. +2
    -0
      karbor/tests/unit/protection/test_cinder_protection_plugin.py
  48. +1
    -0
      karbor/tests/unit/protection/test_glance_protection_plugin.py
  49. +1
    -0
      karbor/tests/unit/protection/test_graph.py
  50. +7
    -0
      karbor/tests/unit/protection/test_nova_protection_plugin.py
  51. +1
    -0
      karbor/tests/unit/protection/test_swift_bank_plugin.py
  52. +1
    -0
      karbor/wsgi/common.py
  53. +1
    -0
      tools/install_venv_common.py

+ 0
- 4
karbor/api/v1/plans.py View File

@ -70,10 +70,6 @@ class PlanViewBuilder(common.ViewBuilder):
_collection_name = "plans"
def __init__(self):
"""Initialize view builder."""
super(PlanViewBuilder, self).__init__()
def detail(self, request, plan):
"""Detailed view of a single plan."""


+ 0
- 4
karbor/api/v1/protectables.py View File

@ -56,10 +56,6 @@ class ProtectableViewBuilder(common.ViewBuilder):
_collection_name = "protectables"
def __init__(self):
"""Initialize view builder."""
super(ProtectableViewBuilder, self).__init__()
def show(self, request, protectable_type):
"""Detailed view of a single protectable_type."""
protectable_type_ref = {


+ 0
- 8
karbor/api/v1/providers.py View File

@ -76,10 +76,6 @@ class ProviderViewBuilder(common.ViewBuilder):
_collection_name = "providers"
def __init__(self):
"""Initialize view builder."""
super(ProviderViewBuilder, self).__init__()
def detail(self, request, provider):
"""Detailed view of a single provider."""
provider_ref = {
@ -130,10 +126,6 @@ class CheckpointViewBuilder(common.ViewBuilder):
_collection_name = "checkpoints"
def __init__(self):
"""Initialize view builder."""
super(CheckpointViewBuilder, self).__init__()
def detail(self, request, checkpoint):
"""Detailed view of a single checkpoint."""
checkpoint_ref = {


+ 0
- 4
karbor/api/v1/restores.py View File

@ -68,10 +68,6 @@ class RestoreViewBuilder(common.ViewBuilder):
_collection_name = "restores"
def __init__(self):
"""Initialize view builder."""
super(RestoreViewBuilder, self).__init__()
def detail(self, request, restore):
"""Detailed view of a single restore."""
restore_ref = {


+ 0
- 9
karbor/cmd/manage.py View File

@ -54,9 +54,6 @@ def args(*args, **kwargs):
class DbCommands(object):
"""Class for managing the database."""
def __init__(self):
pass
@args('version', nargs='?', default=None,
help='Database version')
def sync(self, version=None):
@ -91,9 +88,6 @@ class DbCommands(object):
class VersionCommands(object):
"""Class for exposing the codebase version."""
def __init__(self):
pass
def list(self):
print(version.version_string())
@ -104,9 +98,6 @@ class VersionCommands(object):
class ConfigCommands(object):
"""Class for exposing the flags defined by flag_file(s)."""
def __init__(self):
pass
@args('param', nargs='?', default=None,
help='Configuration parameter to display (default: %(default)s)')
def list(self, param=None):


+ 1
- 0
karbor/loadables.py View File

@ -46,6 +46,7 @@ from karbor import exception
class BaseLoader(object):
def __init__(self, loadable_cls_type):
super(BaseLoader, self).__init__()
mod = sys.modules[self.__class__.__module__]
self.path = os.path.abspath(mod.__path__[0])
self.package = mod.__package__


+ 1
- 0
karbor/rpc.py View File

@ -92,6 +92,7 @@ class RequestContextSerializer(messaging.Serializer):
def __init__(self, base):
self._base = base
super(RequestContextSerializer, self).__init__()
def serialize_entity(self, context, entity):
if not self._base:


+ 2
- 0
karbor/service.py View File

@ -330,6 +330,7 @@ class WSGIService(service.ServiceBase):
self.app,
host=self.host,
port=self.port)
super(WSGIService, self).__init__()
def _get_manager(self):
"""Initialize a Manager object appropriate for this service.
@ -431,6 +432,7 @@ def wait():
class Launcher(object):
def __init__(self):
super(Launcher, self).__init__()
self.launch_service = serve
self.wait = wait


+ 1
- 0
karbor/services/operationengine/engine/executors/base.py View File

@ -23,6 +23,7 @@ import six
class BaseExecutor(object):
def __init__(self, operation_manager):
self._operation_manager = operation_manager
super(BaseExecutor, self).__init__()
@abstractmethod
def execute_operation(self, operation_id, triggered_time,


+ 0
- 3
karbor/services/operationengine/engine/executors/scheduled_operation_executor.py View File

@ -32,9 +32,6 @@ class ScheduledOperationExecutor(base.BaseExecutor):
'is_canceled': 'is_canceled'
}
def __init__(self, operation_manager):
super(ScheduledOperationExecutor, self).__init__(operation_manager)
def execute_operation(self, operation_id, triggered_time,
expect_start_time, window_time, **kwargs):


+ 1
- 0
karbor/services/operationengine/engine/triggers/timetrigger/time_trigger.py View File

@ -50,6 +50,7 @@ LOG = logging.getLogger(__name__)
class TriggerOperationGreenThread(object):
def __init__(self, first_run_time, function):
super(TriggerOperationGreenThread, self).__init__()
self._is_sleeping = True
self._pre_run_time = None
self._running = False


+ 1
- 0
karbor/services/operationengine/engine/triggers/timetrigger/timeformats/crontab_time.py View File

@ -25,6 +25,7 @@ class Crontab(timeformats.TimeFormat):
def __init__(self, start_time, pattern):
self._start_time = start_time
self._pattern = pattern
super(Crontab, self).__init__(start_time, pattern)
@classmethod
def check_time_format(cls, pattern):


+ 1
- 0
karbor/services/operationengine/operation_manager.py View File

@ -22,6 +22,7 @@ from karbor.services.operationengine import operations
class OperationManager(object):
"""Manage all operation classes which are defined at operations dir."""
def __init__(self, user_trust_manager):
super(OperationManager, self).__init__()
self._user_trust_manager = user_trust_manager
all_ops = operations.all_operations()
self._ops_map = {op.OPERATION_TYPE: op(self._user_trust_manager)


+ 1
- 0
karbor/services/operationengine/operations/base.py View File

@ -46,6 +46,7 @@ class Operation(object):
OPERATION_TYPE = ""
def __init__(self, user_trust_manager):
super(Operation, self).__init__()
self._user_trust_manager = user_trust_manager
self._karbor_endpoint = None


+ 0
- 3
karbor/services/operationengine/operations/protect_operation.py View File

@ -25,9 +25,6 @@ class ProtectOperation(base.Operation):
OPERATION_TYPE = "protect"
def __init__(self, user_trust_manager):
super(ProtectOperation, self).__init__(user_trust_manager)
def check_operation_definition(self, operation_definition):
provider_id = operation_definition.get("provider_id")
if not provider_id or not uuidutils.is_uuid_like(provider_id):


+ 1
- 0
karbor/services/operationengine/user_trust_manager.py View File

@ -20,6 +20,7 @@ LOG = logging.getLogger(__name__)
class UserTrustManager(object):
def __init__(self):
super(UserTrustManager, self).__init__()
self._user_trust_map = {}
self._skp = karbor_keystone_plugin.KarborKeystonePlugin()


+ 3
- 0
karbor/services/protection/bank_plugin.py View File

@ -37,6 +37,7 @@ class LeasePlugin(object):
@six.add_metaclass(abc.ABCMeta)
class BankPlugin(object):
def __init__(self, config=None):
super(BankPlugin, self).__init__()
self._config = config
@abc.abstractmethod
@ -74,6 +75,7 @@ class Bank(object):
_KEY_DOT_VALIDATION = re.compile('/\.{1,2}(/|$)')
def __init__(self, plugin):
super(Bank, self).__init__()
self._plugin = plugin
def _normalize_key(self, key):
@ -160,6 +162,7 @@ class BankSection(object):
_SECTION_DOT_VALIDATION = re.compile('/\.{1,2}(/|$)')
def __init__(self, bank, section, is_writable=True):
super(BankSection, self).__init__()
self._validate_section(section)
self._bank = bank


+ 1
- 0
karbor/services/protection/checkpoint.py View File

@ -34,6 +34,7 @@ class Checkpoint(object):
def __init__(self, checkpoint_section, indices_section,
bank_lease, checkpoint_id):
super(Checkpoint, self).__init__()
self._id = checkpoint_id
self._checkpoint_section = checkpoint_section
self._indices_section = indices_section


+ 0
- 6
karbor/services/protection/flows/delete.py View File

@ -19,9 +19,6 @@ LOG = logging.getLogger(__name__)
class InitiateDeleteTask(task.Task):
def __init__(self):
super(InitiateDeleteTask, self).__init__()
def execute(self, checkpoint, *args, **kwargs):
LOG.debug("Initiate delete checkpoint_id: %s", checkpoint.id)
checkpoint.status = constants.CHECKPOINT_STATUS_DELETING
@ -34,9 +31,6 @@ class InitiateDeleteTask(task.Task):
class CompleteDeleteTask(task.Task):
def __init__(self, *args, **kwargs):
super(CompleteDeleteTask, self).__init__(*args, **kwargs)
def execute(self, checkpoint):
LOG.debug("Complete delete checkpoint_id: %s", checkpoint.id)
checkpoint.delete()


+ 0
- 6
karbor/services/protection/flows/protect.py View File

@ -20,9 +20,6 @@ LOG = logging.getLogger(__name__)
class InitiateProtectTask(task.Task):
def __init__(self):
super(InitiateProtectTask, self).__init__()
def execute(self, checkpoint, *args, **kwargs):
LOG.debug("Initiate protect checkpoint_id: %s", checkpoint.id)
checkpoint.status = constants.CHECKPOINT_STATUS_PROTECTING
@ -35,9 +32,6 @@ class InitiateProtectTask(task.Task):
class CompleteProtectTask(task.Task):
def __init__(self):
super(CompleteProtectTask, self).__init__()
def execute(self, checkpoint):
LOG.debug("Complete protect checkpoint_id: %s", checkpoint.id)
checkpoint.status = constants.CHECKPOINT_STATUS_AVAILABLE


+ 0
- 16
karbor/services/protection/flows/restore.py View File

@ -35,9 +35,6 @@ LOG = logging.getLogger(__name__)
class InitiateRestoreTask(task.Task):
def __init__(self):
super(InitiateRestoreTask, self).__init__()
def execute(self, restore, *args, **kwargs):
LOG.debug("Initiate restore restore_id: %s", restore.id)
restore['status'] = constants.RESTORE_STATUS_IN_PROGRESS
@ -50,9 +47,6 @@ class InitiateRestoreTask(task.Task):
class CompleteRestoreTask(task.Task):
def __init__(self):
super(CompleteRestoreTask, self).__init__()
def execute(self, restore, *args, **kwargs):
LOG.debug("Complete restore restore_id: %s", restore.id)
restore['status'] = constants.RESTORE_STATUS_SUCCESS
@ -62,9 +56,6 @@ class CompleteRestoreTask(task.Task):
class CreateHeatTask(task.Task):
default_provides = ['heat_client', 'heat_template']
def __init__(self, *args, **kwargs):
super(CreateHeatTask, self).__init__(*args, **kwargs)
def execute(self, context, heat_conf):
LOG.info('Creating Heat template. Target: "%s"'
% heat_conf.get('auth_url', '(None)'))
@ -79,9 +70,6 @@ class CreateHeatTask(task.Task):
class CreateStackTask(task.Task):
default_provides = 'stack_id'
def __init__(self, *args, **kwargs):
super(CreateStackTask, self).__init__(*args, **kwargs)
def execute(self, heat_client, heat_template):
stack_name = "restore_%s" % uuidutils.generate_uuid()
if heat_template.len() == 0:
@ -100,10 +88,6 @@ class CreateStackTask(task.Task):
class SyncRestoreStatusTask(task.Task):
def __init__(self, *args, **kwargs):
super(SyncRestoreStatusTask, self).__init__(*args, **kwargs)
def execute(self, stack_id, heat_client, restore):
if stack_id is None:
LOG.info('Not syncing Heat stack status, stack is empty')


+ 1
- 0
karbor/services/protection/flows/worker.py View File

@ -36,6 +36,7 @@ CONF.register_opts(workflow_opts)
class Worker(object):
def __init__(self, engine_path=None):
super(Worker, self).__init__()
try:
self.workflow_engine = self._load_engine(engine_path)
except Exception:


+ 0
- 3
karbor/services/protection/flows/workflow.py View File

@ -87,9 +87,6 @@ class WorkFlowEngine(object):
class TaskFlowEngine(WorkFlowEngine):
def __init__(self):
super(TaskFlowEngine, self).__init__()
def build_flow(self, flow_name, flow_type='graph'):
if flow_type == 'linear':
return linear_flow.Flow(flow_name)


+ 1
- 0
karbor/services/protection/graph.py View File

@ -111,6 +111,7 @@ class GraphWalkerListener(object):
class GraphWalker(object):
def __init__(self):
super(GraphWalker, self).__init__()
self._listeners = []
def register_listener(self, graph_walker_listener):


+ 1
- 0
karbor/services/protection/protectable_plugin.py View File

@ -21,6 +21,7 @@ class ProtectablePlugin(object):
"""
def __init__(self, context=None):
super(ProtectablePlugin, self).__init__()
self._context = context
def instance(self, context):


+ 1
- 0
karbor/services/protection/protectable_registry.py View File

@ -31,6 +31,7 @@ def _raise_extension_exception(extmanager, ep, err):
class ProtectableRegistry(object):
def __init__(self):
super(ProtectableRegistry, self).__init__()
self._protectable_map = {}
self._plugin_map = {}


+ 1
- 3
karbor/services/protection/protection_plugin.py View File

@ -12,9 +12,6 @@
class Operation(object):
def __init__(self):
super(Operation, self).__init__()
def on_prepare_begin(self, checkpoint, resource, context, parameters,
**kwargs):
"""on_prepare_begin hook runs before any child resource's hooks run
@ -73,6 +70,7 @@ class Operation(object):
class ProtectionPlugin(object):
def __init__(self, config=None):
super(ProtectionPlugin, self).__init__()
self._config = config
def get_protect_operation(self, resource):


+ 1
- 3
karbor/services/protection/protection_plugins/image/image_protection_plugin.py View File

@ -173,9 +173,6 @@ class ProtectOperation(protection_plugin.Operation):
class DeleteOperation(protection_plugin.Operation):
def __init__(self):
super(DeleteOperation, self).__init__()
def on_main(self, checkpoint, resource, context, parameters, **kwargs):
image_id = resource.id
bank_section = checkpoint.get_resource_bank_section(image_id)
@ -275,6 +272,7 @@ class RestoreOperation(protection_plugin.Operation):
class ImageBankIO(object):
def __init__(self, bank_section, sorted_objects):
super(ImageBankIO, self).__init__()
self.bank_section = bank_section
self.sorted_objects = sorted_objects
self.obj_size = len(sorted_objects)


+ 0
- 6
karbor/services/protection/protection_plugins/noop_plugin.py View File

@ -15,9 +15,6 @@ from karbor.services.protection import protection_plugin
class NoopOperation(protection_plugin.Operation):
def __init__(self):
super(NoopOperation, self).__init__()
def on_prepare_begin(self, *args, **kwargs):
pass
@ -32,9 +29,6 @@ class NoopOperation(protection_plugin.Operation):
class NoopProtectionPlugin(protection_plugin.ProtectionPlugin):
def __init__(self, config=None):
super(NoopProtectionPlugin, self).__init__(config)
def get_protect_operation(self, resource):
return NoopOperation()


+ 0
- 12
karbor/services/protection/protection_plugins/server/nova_protection_plugin.py View File

@ -30,9 +30,6 @@ FLOATING_IP_ASSOCIATION = 'OS::Nova::FloatingIPAssociation'
class ProtectOperation(protection_plugin.Operation):
def __init__(self):
super(ProtectOperation, self).__init__()
def on_main(self, checkpoint, resource, context, parameters, **kwargs):
server_id = resource.id
bank_section = checkpoint.get_resource_bank_section(server_id)
@ -144,9 +141,6 @@ class ProtectOperation(protection_plugin.Operation):
class DeleteOperation(protection_plugin.Operation):
def __init__(self):
super(DeleteOperation, self).__init__()
def on_main(self, checkpoint, resource, context, parameters, **kwargs):
resource_id = resource.id
bank_section = checkpoint.get_resource_bank_section(resource_id)
@ -176,9 +170,6 @@ class DeleteOperation(protection_plugin.Operation):
class RestoreOperation(protection_plugin.Operation):
def __init__(self):
super(RestoreOperation, self).__init__()
def on_complete(self, checkpoint, resource, context, parameters, **kwargs):
original_server_id = resource.id
heat_template = kwargs.get("heat_template")
@ -322,9 +313,6 @@ class RestoreOperation(protection_plugin.Operation):
class NovaProtectionPlugin(protection_plugin.ProtectionPlugin):
_SUPPORT_RESOURCE_TYPES = [constants.SERVER_RESOURCE_TYPE]
def __init__(self, config=None):
super(NovaProtectionPlugin, self).__init__(config)
@classmethod
def get_supported_resources_types(cls):
return cls._SUPPORT_RESOURCE_TYPES


+ 0
- 3
karbor/services/protection/protection_plugins/volume/cinder_protection_plugin.py View File

@ -267,9 +267,6 @@ class ProtectOperation(protection_plugin.Operation):
class RestoreOperation(protection_plugin.Operation):
def __init__(self):
super(RestoreOperation, self).__init__()
def on_main(self, checkpoint, resource, context, parameters, heat_template,
**kwargs):
resource_id = resource.id


+ 2
- 0
karbor/services/protection/restore_heat.py View File

@ -22,6 +22,7 @@ LOG = logging.getLogger(__name__)
class HeatResource(object):
def __init__(self, resource_id, type):
super(HeatResource, self).__init__()
self.resource_id = resource_id
self._type = type
self._properties = {}
@ -44,6 +45,7 @@ class HeatTemplate(object):
description = "karbor restore template"
def __init__(self):
super(HeatTemplate, self).__init__()
self._resources = []
self._original_id_resource_map = {}
self._original_id_parameter_map = {}


+ 1
- 0
karbor/tests/base.py View File

@ -34,6 +34,7 @@ _DB_CACHE = None
class Database(fixtures.Fixture):
def __init__(self, db_api, db_migrate, sql_connection):
super(Database, self).__init__()
self.sql_connection = sql_connection
# Suppress logging for test runs


+ 1
- 0
karbor/tests/fullstack/karbor_base.py View File

@ -122,6 +122,7 @@ class ObjectStore(object):
"""
def __init__(self):
super(ObjectStore, self).__init__()
self._close_funcs = []
def store(self, obj, close_func=None):


+ 8
- 0
karbor/tests/fullstack/karbor_objects.py View File

@ -30,6 +30,7 @@ DEFAULT_NETWORK = "private"
class Checkpoint(object):
def __init__(self):
super(Checkpoint, self).__init__()
self.id = None
self._provider_id = None
self.karbor_client = base._get_karbor_client()
@ -69,6 +70,7 @@ class Plan(object):
_name_id = 0
def __init__(self):
super(Plan, self).__init__()
self.id = None
self.karbor_client = base._get_karbor_client()
@ -104,6 +106,7 @@ class Plan(object):
class Restore(object):
def __init__(self):
super(Restore, self).__init__()
self.id = None
self.karbor_client = base._get_karbor_client()
@ -138,6 +141,7 @@ class Trigger(object):
_name_id = 0
def __init__(self):
super(Trigger, self).__init__()
self.id = None
self.karbor_client = base._get_karbor_client()
@ -163,6 +167,7 @@ class ScheduledOperation(object):
_name_id = 0
def __init__(self):
super(ScheduledOperation, self).__init__()
self.id = None
self.karbor_client = base._get_karbor_client()
@ -194,6 +199,7 @@ class Server(object):
_name_id = 0
def __init__(self):
super(Server, self).__init__()
self.id = None
self._name = None
self.nova_client = base._get_nova_client()
@ -304,6 +310,7 @@ class Volume(object):
_name_id = 0
def __init__(self):
super(Volume, self).__init__()
self.id = None
self._name = None
self.cinder_client = base._get_cinder_client()
@ -366,6 +373,7 @@ class Share(object):
_name_id = 0
def __init__(self):
super(Share, self).__init__()
self.id = None
self._name = None
self.manila_client = base._get_manila_client()


+ 1
- 0
karbor/tests/unit/api/v1/test_scheduled_operation.py View File

@ -25,6 +25,7 @@ from karbor.tests.unit.api.v1 import test_triggers
class FakeRemoteOperationApi(object):
def __init__(self):
super(FakeRemoteOperationApi, self).__init__()
self._create_operation_exception = None
self._delete_operation_exception = None


+ 2
- 0
karbor/tests/unit/clients/test_eisoo.py View File

@ -21,6 +21,7 @@ from karbor.tests import base
class FakeConfig(object):
def __init__(self):
super(FakeConfig, self).__init__()
self.eisoo_client = EisooClient()
def __call__(self, args):
@ -32,6 +33,7 @@ class FakeConfig(object):
class EisooClient(object):
def __init__(self):
super(EisooClient, self).__init__()
self.eisoo_endpoint = 'eisoo_endpoint'
self.eisoo_app_id = 'eisoo_app_id'
self.eisoo_app_secret = 'eisoo_app_secret'


+ 1
- 0
karbor/tests/unit/objects/test_scheduled_operation_state.py View File

@ -108,6 +108,7 @@ class TestScheduledOperationStateList(test_objects.BaseObjectsTestCase):
class FakeEnv(object):
def __init__(self, ctx):
super(FakeEnv, self).__init__()
self.context = ctx
def do_init(self):


+ 1
- 0
karbor/tests/unit/operationengine/engine/executors/test_green_thread_executor.py View File

@ -25,6 +25,7 @@ from karbor.tests import base
class FakeOperationManager(object):
def __init__(self):
super(FakeOperationManager, self).__init__()
self._op_id = 0
def run_operation(self, operation_type, operation_definition, **kwargs):


+ 2
- 0
karbor/tests/unit/operationengine/engine/triggers/test_trigger_manager.py View File

@ -22,6 +22,8 @@ from karbor.tests import base
class FakeTrigger(triggers.BaseTrigger):
def __init__(self, trigger_id, trigger_property, executor):
super(FakeTrigger, self).__init__(trigger_id, trigger_property,
executor)
self._ops = set()
def shutdown(self):


+ 2
- 1
karbor/tests/unit/operationengine/engine/triggers/timetrigger/test_time_trigger.py View File

@ -24,7 +24,7 @@ from karbor.tests import base
class FakeTimeFormat(object):
def __init__(self, start_time, pattern):
pass
super(FakeTimeFormat, self).__init__()
@classmethod
def check_time_format(cls, pattern):
@ -39,6 +39,7 @@ class FakeTimeFormat(object):
class FakeExecutor(object):
def __init__(self):
super(FakeExecutor, self).__init__()
self._ops = {}
def execute_operation(self, operation_id, triggered_time,


+ 1
- 0
karbor/tests/unit/operationengine/operations/test_protect_operation.py View File

@ -40,6 +40,7 @@ class FakeCheckPoint(object):
class FakeKarborClient(object):
def __init__(self):
super(FakeKarborClient, self).__init__()
self._check_point = FakeCheckPoint()
@property


+ 1
- 0
karbor/tests/unit/operationengine/test_manager.py View File

@ -24,6 +24,7 @@ from karbor.tests import base
class FakeTriggerManager(object):
def __init__(self):
super(FakeTriggerManager, self).__init__()
self._trigger = {}
def register_operation(self, trigger_id, operation_id, **kwargs):


+ 1
- 0
karbor/tests/unit/protection/fake_clients.py View File

@ -39,4 +39,5 @@ class FakeHeatClient(object):
return FakeStacks[stack_id]
def __init__(self):
super(FakeHeatClient, self).__init__()
self.stacks = self.Stacks()

+ 2
- 1
karbor/tests/unit/protection/fake_swift_client.py View File

@ -18,7 +18,7 @@ from swiftclient import ClientException
class FakeSwiftClient(object):
def __init__(self, *args, **kwargs):
pass
super(FakeSwiftClient, self).__init__()
@classmethod
def connection(cls, *args, **kargs):
@ -27,6 +27,7 @@ class FakeSwiftClient(object):
class FakeSwiftConnection(object):
def __init__(self, *args, **kwargs):
super(FakeSwiftConnection, self).__init__()
self.swiftdir = tempfile.mkdtemp()
self.object_headers = {}


+ 2
- 3
karbor/tests/unit/protection/fakes.py View File

@ -70,6 +70,7 @@ def fake_protection_plan():
}
return protection_plan
plan_resources = [A, B, C, D]
@ -193,6 +194,7 @@ class FakeProtectionPlugin(protection_plugin.ProtectionPlugin):
class FakeCheckpoint(object):
def __init__(self):
super(FakeCheckpoint, self).__init__()
self.id = 'fake_checkpoint'
self.status = 'available'
self.resource_graph = resource_graph
@ -241,9 +243,6 @@ class FakeProvider(provider.PluggableProtectionProvider):
class FakeFlowEngine(object):
def __init__(self):
super(FakeFlowEngine, self).__init__()
def create_task(self, function, requires=None, provides=None,
inject=None, **kwargs):
name = kwargs.get('name', None)


+ 2
- 0
karbor/tests/unit/protection/test_cinder_protection_plugin.py View File

@ -62,6 +62,7 @@ def call_hooks(operation, checkpoint, resource, context, parameters, **kwargs):
class FakeCheckpoint(object):
def __init__(self, section):
super(FakeCheckpoint, self).__init__()
self.bank_section = section
self.id = "fake_id"
@ -71,6 +72,7 @@ class FakeCheckpoint(object):
class BackupResponse(object):
def __init__(self, bkup_id, final_status, working_status, time_to_work):
super(BackupResponse, self).__init__()
self._final_status = final_status
self._working_status = working_status
self._time_to_work = time_to_work


+ 1
- 0
karbor/tests/unit/protection/test_glance_protection_plugin.py View File

@ -81,6 +81,7 @@ def call_hooks(operation, checkpoint, resource, context, parameters, **kwargs):
class CheckpointCollection(object):
def __init__(self):
super(CheckpointCollection, self).__init__()
self.bank_section = fake_bank_section
def get_resource_bank_section(self, resource_id):


+ 1
- 0
karbor/tests/unit/protection/test_graph.py View File

@ -197,6 +197,7 @@ class GraphBuilderTest(base.TestCase):
class _TestGraphWalkerListener(graph.GraphWalkerListener):
def __init__(self, expected_event_stream, test):
super(_TestGraphWalkerListener, self).__init__()
# Because the testing famework is badly designed
# I need to have a reference to the test to raise assertions
self._test = test


+ 7
- 0
karbor/tests/unit/protection/test_nova_protection_plugin.py View File

@ -30,6 +30,7 @@ import mock
class Server(object):
def __init__(self, id, addresses, availability_zone,
flavor, key_name, security_groups):
super(Server, self).__init__()
self.id = id
self.addresses = addresses
self.__setattr__("OS-EXT-AZ:availability_zone", availability_zone)
@ -41,6 +42,7 @@ class Server(object):
class Volume(object):
def __init__(self, id, volume_type, status, bootable,
attachments, name=None):
super(Volume, self).__init__()
self.id = id
self.volume_type = volume_type
self.status = status
@ -51,6 +53,7 @@ class Volume(object):
class Image(object):
def __init__(self, id, status, disk_format, container_format):
super(Image, self).__init__()
self.id = id
self.status = status
self.disk_format = disk_format
@ -152,6 +155,7 @@ class FakeNovaClient(object):
return None
def __init__(self):
super(FakeNovaClient, self).__init__()
self.servers = self.Servers()
@ -171,6 +175,7 @@ class FakeGlanceClient(object):
return None
def __init__(self):
super(FakeGlanceClient, self).__init__()
self.images = self.Images()
@ -186,6 +191,7 @@ class FakeCinderClient(object):
return None
def __init__(self):
super(FakeCinderClient, self).__init__()
self.volumes = self.Volumes()
@ -241,6 +247,7 @@ ResourceNode = collections.namedtuple(
class Checkpoint(object):
def __init__(self):
super(Checkpoint, self).__init__()
self.id = "checkpoint_id"
self.graph = []


+ 1
- 0
karbor/tests/unit/protection/test_swift_bank_plugin.py View File

@ -25,6 +25,7 @@ CONF = cfg.CONF
class FakeConf(object):
def __init__(self):
super(FakeConf, self).__init__()
self.lease_expire_window = 600
self.lease_renew_window = 120
self.lease_validity_window = 100


+ 1
- 0
karbor/wsgi/common.py View File

@ -133,6 +133,7 @@ class Middleware(Application):
return _factory
def __init__(self, application):
super(Middleware, self).__init__()
self.application = application
def process_request(self, req):


+ 1
- 0
tools/install_venv_common.py View File

@ -35,6 +35,7 @@ class InstallVenv(object):
def __init__(self, root, venv, requirements,
test_requirements, py_version,
project):
super(InstallVenv, self).__init__()
self.root = root
self.venv = venv
self.requirements = requirements


Loading…
Cancel
Save