]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Substituting NTP by Chrony
authorFrank Brehm <frank.brehm@pixelpark.com>
Mon, 25 Jun 2018 14:12:27 +0000 (16:12 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Mon, 25 Jun 2018 14:12:27 +0000 (16:12 +0200)
lib/cr_vmware_tpl/handler.py

index 315067c5c597db7005abef96f6623f99b3a595c5..c887d2f4456741244a86f460d4e78b54d0261e5e 100644 (file)
@@ -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)