from .config import CrTplConfiguration
-__version__ = '0.5.1'
+__version__ = '0.6.1'
LOG = logging.getLogger(__name__)
TZ = pytz.timezone('Europe/Berlin')
self.tpl_network = None
self.tpl_cluster = None
self.tpl_vm = None
+ self.ts_start_install = None
+ self.ts_finish_install = None
+ self.initial_sleep = 60
+ self.interval_poll = 0.5
+ self.interval_dot = 2
if initialized:
self.initialized = True
raise HandlerError(
"Could not find VM after creating.")
self.poweron_vm()
+ self.wait_for_finish_install()
finally:
LOG.debug("Disconnecting from vSphere host {h}:{p} ...".format(
h=self.config.vsphere_host, p=self.config.vsphere_port))
task = self.tpl_vm.PowerOnVM_Task()
self.wait_for_tasks([task])
+ self.ts_start_install = time.time()
LOG.debug("VM {!r} successful powered on.".format(self.config.template_vm))
+ # -------------------------------------------------------------------------
+ def wait_for_finish_install(self):
+
+ LOG.info("Waiting for finishing installation ...")
+
+ LOG.debug("Waiting initially for {} seconds.")
+
+ cur_time = time.time()
+ cur_duration = cur_time - self.ts_start_install
+ last_dot = cur_time
+
+ while cur_duration <= self.initial_sleep:
+ time.sleep(self.interval_poll)
+ cur_time = time.time()
+ if (cur_time - last_dot) >= self.interval_dot:
+ sys.stdout.write('.')
+ sys.stdout.flush()
+ last_dot = cur_time
+ cur_duration = cur_time - self.ts_start_install
# =============================================================================