]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Changing Log output on not found storage
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 26 Aug 2020 08:59:49 +0000 (10:59 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 26 Aug 2020 08:59:49 +0000 (10:59 +0200)
lib/cr_vmware_tpl/handler.py

index 3f64c055902335a5a331acb4fa12698863f7d438..6274cd1552d367d06ae718c2808adc0b4bef630b 100644 (file)
@@ -42,7 +42,7 @@ from .cobbler import Cobbler
 
 from .xlate import XLATOR
 
-__version__ = '1.8.0'
+__version__ = '1.8.1'
 
 LOG = logging.getLogger(__name__)
 TZ = pytz.timezone('Europe/Berlin')
@@ -50,6 +50,10 @@ TZ = pytz.timezone('Europe/Berlin')
 _ = XLATOR.gettext
 ngettext = XLATOR.ngettext
 
+MSG_NO_CLUSTER = _(
+    "Could not find a datastore of {size:0.1f} GiB size in "
+    "datastore cluster {c_name!r}.")
+
 
 # =============================================================================
 class TempVmExistsError(ExpectedHandlerError):
@@ -81,10 +85,7 @@ class NoDatastoreFoundError(ExpectedHandlerError):
     def __str__(self):
 
         if self.ds_cluster_name:
-            msg = _(
-                "Could not find a datastore of {size:0.1f} GiB size in "
-                "datastore cluster {c_name!r}.").format(
-                size=self.data_size_gb, c_name=self.ds_cluster_name)
+            msg = MSG_NO_CLUSTER.format(size=self.data_size_gb, c_name=self.ds_cluster_name)
         else:
             msg = _("Could not find a datastore of {:0.1f} GiB size.").format(
                 self.data_size_gb)
@@ -394,14 +395,14 @@ class CrTplHandler(BaseHandler):
         ds_to_use = None
         if self.config.storage_cluster:
             ds_to_use = self.select_data_store_from_cluster()
+            msg = MSG_NO_CLUSTER.format(
+                size=self.config.data_size_gb, c_name=self.config.storage_cluster)
+            LOG.warn(msg)
         if not ds_to_use:
             ds_to_use = self.select_simple_data_store()
 
         if not ds_to_use:
-            c_name = None
-            if self.config.storage_cluster:
-                c_name = self.config.storage_cluster
-            raise NoDatastoreFoundError(self.config.data_size_gb, c_name)
+            raise NoDatastoreFoundError(self.config.data_size_gb)
 
         self.tpl_data_store = ds_to_use
         LOG.info(_("Using datastore {!r} for volume of temporary VM to create.").format(