Kaynağa Gözat

Allow error to be raised if no Import OSMorphing tools are found.

Nashwan Azhari 7 yıl önce
ebeveyn
işleme
1d88355d6a
2 değiştirilmiş dosya ile 7 ekleme ve 8 silme
  1. 4 8
      coriolis/osmorphing/manager.py
  2. 3 0
      coriolis/providers/base.py

+ 4 - 8
coriolis/osmorphing/manager.py

@@ -72,19 +72,15 @@ def morph_image(origin_provider, destination_provider, connection_info,
     except exception.OSMorphingToolsNotFound:
         export_os_morphing_tools = None
 
-    try:
-        (import_os_morphing_tools,
-         os_info) = destination_provider.get_os_morphing_tools(
-            conn, osmorphing_info)
-        import_os_morphing_tools.set_environment(environment)
-    except exception.OSMorphingToolsNotFound:
-        import_os_morphing_tools = None
-        os_info = None
+    (import_os_morphing_tools,
+     os_info) = destination_provider.get_os_morphing_tools(
+         conn, osmorphing_info)
 
     if not import_os_morphing_tools:
         event_manager.progress_update(
             'No OS morphing tools found for this instance')
     else:
+        import_os_morphing_tools.set_environment(environment)
         event_manager.progress_update('OS being migrated: %s' % str(os_info))
 
         (packages_add, _) = import_os_morphing_tools.get_packages()

+ 3 - 0
coriolis/providers/base.py

@@ -129,6 +129,9 @@ class BaseEndpointDestinationOptionsProvider(
 class BaseInstanceProvider(BaseProvider):
 
     def get_os_morphing_tools(self, conn, osmorphing_info):
+        """ Returns a tuple containing the instantiated OSMorphing tools class
+        to use as well as the OS info returned by the tools' `check_os` method.
+        """
         raise exception.OSMorphingToolsNotFound()