From e807ff640687186fc5308170afbd64d2002dc116 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 7 Sep 2021 16:57:26 +0200 Subject: [PATCH] Defining new step 'vmw-test' --- lib/cr_tf/config.py | 2 +- lib/cr_tf/handler.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/cr_tf/config.py b/lib/cr_tf/config.py index 65ab9a9..18adb72 100644 --- a/lib/cr_tf/config.py +++ b/lib/cr_tf/config.py @@ -32,7 +32,7 @@ from .errors import CrTfConfigError from .xlate import XLATOR -__version__ = '1.5.0' +__version__ = '1.5.1' LOG = logging.getLogger(__name__) _ = XLATOR.gettext diff --git a/lib/cr_tf/handler.py b/lib/cr_tf/handler.py index 21f3a65..387ae77 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.5.6' +__version__ = '3.6.0' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -161,16 +161,17 @@ class CreateTerraformHandler(BaseHandler): tz = pytz.timezone(tz_name) steps = ( - 'init', 'read-yaml', 'pdns-zones', 'vmw-init', 'collect-folders', 'vmw-clusters', - 'vmw-datastores', 'vmw-ds-clusters', 'vmw-networks', 'vmw-templates', + 'init', 'vmw-init', 'read-yaml', 'pdns-zones', 'vmw-test', 'collect-folders', + 'vmw-clusters', 'vmw-datastores', 'vmw-ds-clusters', 'vmw-networks', 'vmw-templates', 'validate-yaml', 'validate-storage', 'validate-iface', 'validate-dns', 'perform-dns', 'project-dir', 'tf-files', 'ensure-vmw-folders', ) step_desc = { 'init': _('After initialization of all objects and handlers.'), + 'vmw-init': _('After initialisation of VSPhere handlers.'), 'read-yaml': _('After reading the given YAML file.'), 'pdns-zones': _('After retrieving all DNS zones from PowerDNS.'), - 'vmw-init': _('After initialisation of VSPhere handlers.'), + 'vmw-test': _('After testing VSPhere handlers.'), 'collect-folders': _('After collecting all VMWare and local folders.'), 'vmw-clusters': _('After collecting all VMWare clusters.'), 'vmw-datastores': _('After collecting all VMWare datastores.'), @@ -799,6 +800,9 @@ class CreateTerraformHandler(BaseHandler): # -------------------------------------------------------------------------· def test_vsphere_handlers(self): + if self.stop_at_step == 'vmw-test': + self.incr_verbosity() + for vname in self.vsphere.keys(): try: @@ -814,6 +818,10 @@ class CreateTerraformHandler(BaseHandler): except VSphereExpectedError as e: raise ExpectedHandlerError(str(e)) + LOG.info(_("Finished step {!r}.").format('vmw-test')) + if self.stop_at_step == 'vmw-test': + raise AbortExecution('vmw-test') + # -------------------------------------------------------------------------· def assign_default_vmw_values(self): """Assigning not defined templates and clusters of VMs by their -- 2.39.5