]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
Output about found datastores and datastore clusters.
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 7 Sep 2021 15:35:23 +0000 (17:35 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 7 Sep 2021 15:35:23 +0000 (17:35 +0200)
lib/cr_tf/handler.py

index 387ae772218107cb56a8ecc12b6b777a6657bbaa..a702059295b21bf29521872994b516a3645063e2 100644 (file)
@@ -67,7 +67,7 @@ from .terraform.disk import TerraformDisk
 
 from .xlate import XLATOR
 
-__version__ = '3.6.0'
+__version__ = '3.6.1'
 LOG = logging.getLogger(__name__)
 
 _ = XLATOR.gettext
@@ -867,9 +867,18 @@ class CreateTerraformHandler(BaseHandler):
         if self.stop_at_step == 'vmw-datastores':
             self.incr_verbosity()
 
+        nr_total = 0
+
         for vname in self.vsphere:
             LOG.debug(_("Searching for datastores in VSPhere {!r} ...").format(vname))
             self.vsphere[vname].get_datastores()
+            nr_total += len(self.vsphere[vname].datastores.keys())
+
+        if nr_total:
+            msg = ngettext("Found one datastore.", "Found {n} datastores.", nr_total)
+            LOG.debug(msg.format(n=nr_total))
+        else:
+            LOG.error(_("No VSPhere datastores found."))
 
         LOG.info(_("Finished step {!r}.").format('vmw-datastores'))
         if self.stop_at_step == 'vmw-datastores':
@@ -878,12 +887,21 @@ class CreateTerraformHandler(BaseHandler):
     # -------------------------------------------------------------------------ยท
     def exec_vmw_ds_clusters(self):
 
+        nr_total = 0
+
         if self.stop_at_step == 'vmw-ds-clusters':
             self.incr_verbosity()
 
         for vname in self.vsphere:
             LOG.debug(_("Searching for datastore clusters in VSPhere {!r} ...").format(vname))
             self.vsphere[vname].get_ds_clusters()
+            nr_total += len(self.vsphere[vname].ds_clusters.keys())
+
+        if nr_total:
+            msg = ngettext("Found one datastore cluster.", "Found {n} datastore clusters.", nr_total)
+            LOG.debug(msg.format(n=nr_total))
+        else:
+            LOG.warn(_("No VSPhere datastore clusters found."))
 
         LOG.info(_("Finished step {!r}.").format('vmw-ds-clusters'))
         if self.stop_at_step == 'vmw-ds-clusters':