From c468610e4e27aa0cacb1a7ae36f398f593786510 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 25 Jun 2018 16:12:27 +0200 Subject: [PATCH] Substituting NTP by Chrony --- lib/cr_vmware_tpl/handler.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/cr_vmware_tpl/handler.py b/lib/cr_vmware_tpl/handler.py index 315067c..c887d2f 100644 --- a/lib/cr_vmware_tpl/handler.py +++ b/lib/cr_vmware_tpl/handler.py @@ -36,7 +36,7 @@ from .obj import PpBaseObject from .config import CrTplConfiguration -__version__ = '0.9.2' +__version__ = '0.9.3' LOG = logging.getLogger(__name__) TZ = pytz.timezone('Europe/Berlin') @@ -327,7 +327,23 @@ class CrTplHandler(PpBaseObject): "Strange: did not found a cluster object in data center {!r}.".format( self.config.dc)) - self.tpl_cluster = cluster_list[0] + cluster = None + + for cl in cluster_list: + if not cl.configuration.drsConfig.enabled: + LOG.warn("Cluster {!r} is not enabled.".format(cl.name)) + continue + cluster = cl + + if not cluster: + raise HandlerError( + "Strange: did not found an enabled computing cluster in data center {!r}.".format( + self.config.dc)) + + self.tpl_cluster = cluster + if self.verbose > 2: + LOG.debug("Cluster config:\n{}".format(pp(cluster.configuration))) + LOG.debug("Cluster Resource pool summary:\n{}".format(cluster.resourcePool.summary)) LOG.debug("Using cluster {!r}.".format(self.tpl_cluster.name)) # ------------------------------------------------------------------------- @@ -778,6 +794,7 @@ class CrTplHandler(PpBaseObject): ssh_available = True self.ts_finish_install = time.time() + self.ts_finish_install = time.time() duration = self.ts_finish_install - self.ts_start_install minutes = int(int(duration) / 60) seconds = duration - float(minutes * 60) -- 2.39.5