Remove redundant ctor super calls, add missing

Change-Id: Iad10fe2d520a056a66bda85951c02d80f49020a4
This commit is contained in:
Yuval Brik 2017-05-14 12:10:31 +03:00
parent b69b8f14f7
commit dca5ff046a
53 changed files with 62 additions and 98 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -267,9 +267,6 @@ class ProtectOperation(protection_plugin.Operation):
class RestoreOperation(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, def on_main(self, checkpoint, resource, context, parameters, heat_template,
**kwargs): **kwargs):
resource_id = resource.id resource_id = resource.id

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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