Alessandro Pilotti 9 лет назад
Родитель
Сommit
16c409bd22

+ 0 - 4
coriolis/api/wsgi.py

@@ -1224,9 +1224,6 @@ class Fault(webob.exc.HTTPException):
             if retry:
                 fault_data[fault_name]['retryAfter'] = retry
 
-        # 'code' is an attribute on the fault tag itself
-        metadata = {'attributes': {fault_name: 'code'}}
-
         content_type = req.best_match_content_type()
         serializer = {
             'application/json': JSONDictSerializer(),
@@ -1299,7 +1296,6 @@ class OverLimitFault(webob.exc.HTTPException):
     def __call__(self, request):
         """Serializes the wrapped exception conforming to our error format."""
         content_type = request.best_match_content_type()
-        metadata = {"attributes": {"overLimitFault": "code"}}
 
         def translate(msg):
             locale = request.best_match_language()

+ 4 - 4
coriolis/cmd/api.py

@@ -4,12 +4,12 @@
 import eventlet
 eventlet.monkey_patch()
 
-import sys
+import sys # noqa
 
-from coriolis import service
-from coriolis import utils
+from coriolis import service # noqa
+from coriolis import utils # noqa
 
-from oslo_config import cfg
+from oslo_config import cfg # noqa
 
 CONF = cfg.CONF
 

+ 5 - 5
coriolis/cmd/conductor.py

@@ -4,13 +4,13 @@
 import eventlet
 eventlet.monkey_patch()
 
-import sys
+import sys # noqa
 
-from oslo_config import cfg
+from oslo_config import cfg # noqa
 
-from coriolis.conductor.rpc import server as rpc_server
-from coriolis import service
-from coriolis import utils
+from coriolis.conductor.rpc import server as rpc_server # noqa
+from coriolis import service # noqa
+from coriolis import utils # noqa
 
 CONF = cfg.CONF
 

+ 5 - 5
coriolis/cmd/worker.py

@@ -4,13 +4,13 @@
 import eventlet
 eventlet.monkey_patch()
 
-import sys
+import sys # noqa
 
-from oslo_config import cfg
+from oslo_config import cfg # noqa
 
-from coriolis.worker.rpc import server as rpc_server
-from coriolis import service
-from coriolis import utils
+from coriolis.worker.rpc import server as rpc_server # noqa
+from coriolis import service # noqa
+from coriolis import utils # noqa
 
 CONF = cfg.CONF
 

+ 2 - 1
coriolis/db/sqlalchemy/migrate_repo/manage.py

@@ -1,7 +1,8 @@
+#!/usr/bin/env python
+
 # Copyright 2016 Cloudbase Solutions Srl
 # All Rights Reserved.
 
-#!/usr/bin/env python
 from migrate.versioning.shell import main
 
 if __name__ == '__main__':

+ 0 - 3
coriolis/osmorphing/osmount/windows.py

@@ -1,9 +1,6 @@
 # Copyright 2016 Cloudbase Solutions Srl
 # All Rights Reserved.
 
-import os
-import re
-
 from oslo_log import log as logging
 
 from coriolis import exception

+ 1 - 1
coriolis/providers/backup_writers.py

@@ -141,7 +141,7 @@ class SSHBackupWriter(BaseBackupWriter):
         self._msg_id += 1
         self._stdin.write(data)
         self._stdin.flush()
-        out_msg_id = self._stdout.read(4)
+        self._stdout.read(4)
 
     def _open(self):
         self._connect_ssh()

+ 1 - 2
coriolis/schemas_exceptions.py

@@ -3,8 +3,6 @@
 
 """ Defines a set of exceptions possible during schema loading/validation. """
 
-import json
-
 import jinja2
 import jsonschema
 
@@ -15,6 +13,7 @@ class CoriolisSchemaException(exception.CoriolisException):
     """ Base class for all coriolis schema handling exceptions. """
     message = "Exception occured during schema validation: %(msg)s."
 
+
 class CoriolisSchemaValidationError(
         CoriolisSchemaException, jsonschema.ValidationError):
     """ Raised when a schema validation has failed. """

+ 0 - 37
coriolis/service.py

@@ -1,7 +1,6 @@
 # Copyright 2016 Cloudbase Solutions Srl
 # All Rights Reserved.
 
-import os
 import platform
 
 from oslo_concurrency import processutils
@@ -95,39 +94,3 @@ class MessagingService(service.ServiceBase):
 
     def reset(self):
         self._server.reset()
-
-
-'''
-_launcher = None
-
-def serve(server, workers=None):
-    global _launcher
-    if _launcher:
-        raise RuntimeError(_('serve() can only be called once'))
-
-    _launcher = service.launch(CONF, server, workers=workers)
-
-
-def wait():
-    try:
-        _launcher.wait()
-    except KeyboardInterrupt:
-        _launcher.stop()
-
-
-class Launcher(object):
-    def __init__(self):
-        self.launch_service = serve
-        self.wait = wait
-
-
-def get_process_launcher():
-    # Note(lpetrut): ProcessLauncher uses green pipes which fail on Windows
-    # due to missing support of non-blocking I/O pipes. For this reason, the
-    # service must be spawned differently on Windows, using the ServiceLauncher
-    # class instead.
-    if os.name == 'nt':
-        return Launcher()
-    else:
-        return service.ProcessLauncher(CONF)
-'''

+ 3 - 1
coriolis/tests/providers/base.py

@@ -24,6 +24,7 @@ class ProvidersBaseTestCase(test_base.CoriolisBaseTestCase):
         # NOTE: declare utils.retry_on_error mock; '_patch_utils_retry' should
         # be called to enable them.
         self._mock_utils_retry_inner = testutils.make_identity_decorator_mock()
+
         def retry_dec(*args, **kwargs):
             return self._mock_utils_retry_inner
         self._mock_utils_retry = mock.MagicMock(side_effect=retry_dec)
@@ -64,7 +65,8 @@ class ImportProviderTestCase(ProvidersBaseTestCase):
         self._test_target_env = mock.sentinel.target_environment
         self._test_export_info = mock.sentinel.export_info
 
-    def _test_morphing_called(self, os_type="", nics_info=None, ignore_devs=[]):
+    def _test_morphing_called(self, os_type="", nics_info=None,
+                              ignore_devs=[]):
         self._mock_morph.morph_image.assert_called_once_with(
             self._mock_conn_info, os_type,
             self._hypervisor, self._platform,

+ 1 - 0
coriolis/tests/testutils.py

@@ -7,6 +7,7 @@ def identity_dec(item, *args, **kwargs):
     """ A decorator which adds nothing to the decorated item. """
     return item
 
+
 def make_identity_decorator_mock():
     """ Returns a MagicMock with identity_dec as a side-effect. """
     return mock.MagicMock(side_effect=identity_dec)