From a3e9013b9cc411bb724dff8d778995a3f8bfb92a Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 7 Sep 2021 17:35:23 +0200 Subject: [PATCH] Output about found datastores and datastore clusters. --- lib/cr_tf/handler.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/cr_tf/handler.py b/lib/cr_tf/handler.py index 387ae77..a702059 100644 --- a/lib/cr_tf/handler.py +++ b/lib/cr_tf/handler.py @@ -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': -- 2.39.5