]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Moving Cobbler related methods from lib/cr_vmware_tpl/handler/__init__.py into lib...
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 10 Oct 2023 09:10:12 +0000 (11:10 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 10 Oct 2023 09:10:12 +0000 (11:10 +0200)
lib/cr_vmware_tpl/handler/__init__.py
lib/cr_vmware_tpl/handler/cobbler.py

index 8446291fbec6c8c6be3f50d8801fee7b2a21fd54..cdc08418c31db93fc169af11b56e4474aa34cfcc 100644 (file)
@@ -58,7 +58,7 @@ from ..errors import MSG_NO_CLUSTER, TempVmExistsError, NoDatastoreFoundError
 
 from ..xlate import XLATOR
 
-__version__ = '2.4.2'
+__version__ = '2.4.3'
 
 LOG = logging.getLogger(__name__)
 TZ = pytz.timezone('Europe/Berlin')
@@ -365,27 +365,6 @@ class CrTplHandler(BaseHandler, HandlerLdapMixin, HandlerCobblerMixin):
 
         return 0
 
-    # -------------------------------------------------------------------------
-    def check_for_cobbler_distro(self):
-        LOG.debug(_(
-            "Checking, whether distro {!r} is available "
-            "on the cobbler host.").format(self.cfg.cobbler_distro))
-
-        distro_list = self.cobbler.get_distro_list()
-        if self.cfg.cobbler_distro not in distro_list:
-            msg = _("Did not found distro {!r} on the cobbler host.").format(
-                self.cfg.cobbler_distro)
-            raise ExpectedHandlerError(msg)
-        if self.verbose > 1:
-            msg = _("Distro {!r} is available on the cobbler host.").format(
-                self.cfg.cobbler_distro)
-            LOG.debug(msg)
-
-        if not self.cobbler.verify_distro_repos(self.cfg.current_distro):
-            msg = _("Not all repos for distro {!r} were found on Cobbler server.").format(
-                self.cfg.current_distro.name)
-            raise ExpectedHandlerError(msg)
-
     # -------------------------------------------------------------------------
     def check_for_temp_tpl_vm(self, no_error=False):
 
index a3c22189231bf21f85a521c4c46e8fb0f75a5eb0..117983b4b86581aaa5e5c7b8509f6642161b75f4 100644 (file)
@@ -13,16 +13,12 @@ import logging
 
 # Third party modules
 
-from fb_tools.common import pp, is_sequence
-from fb_tools.errors import HandlerError
+from fb_tools.errors import ExpectedHandlerError
 
 # Own modules
-
-from .. import print_section_start, print_section_end
-
 from ..xlate import XLATOR
 
-__version__ = '0.1.0'
+__version__ = '0.2.0'
 
 LOG = logging.getLogger(__name__)
 
@@ -35,7 +31,26 @@ class HandlerCobblerMixin():
     A mixin class for extending the CrTplHandler class for Cobbler dependend methods.
     """
 
-    pass
+    # -------------------------------------------------------------------------
+    def check_for_cobbler_distro(self):
+        LOG.debug(_(
+            "Checking, whether distro {!r} is available "
+            "on the cobbler host.").format(self.cfg.cobbler_distro))
+
+        distro_list = self.cobbler.get_distro_list()
+        if self.cfg.cobbler_distro not in distro_list:
+            msg = _("Did not found distro {!r} on the cobbler host.").format(
+                self.cfg.cobbler_distro)
+            raise ExpectedHandlerError(msg)
+        if self.verbose > 1:
+            msg = _("Distro {!r} is available on the cobbler host.").format(
+                self.cfg.cobbler_distro)
+            LOG.debug(msg)
+
+        if not self.cobbler.verify_distro_repos(self.cfg.current_distro):
+            msg = _("Not all repos for distro {!r} were found on Cobbler server.").format(
+                self.cfg.current_distro.name)
+            raise ExpectedHandlerError(msg)
 
 
 # =============================================================================