From: Frank Brehm Date: Mon, 22 Jun 2020 13:00:09 +0000 (+0200) Subject: Detecting post install errors X-Git-Tag: 2.1.2^2~9^2~31^2~14 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=e0541df491386375909a958049a4338c850cbfda;p=pixelpark%2Fcreate-vmware-tpl.git Detecting post install errors --- diff --git a/lib/cr_vmware_tpl/handler.py b/lib/cr_vmware_tpl/handler.py index 3758f94..7ac2884 100644 --- a/lib/cr_vmware_tpl/handler.py +++ b/lib/cr_vmware_tpl/handler.py @@ -42,7 +42,7 @@ from .cobbler import CobblerError, Cobbler from .xlate import XLATOR -__version__ = '1.6.6' +__version__ = '1.6.7' LOG = logging.getLogger(__name__) TZ = pytz.timezone('Europe/Berlin') @@ -298,10 +298,10 @@ class CrTplHandler(BaseHandler): self.eval_tpl_ip() self.wait_for_finish_install() -# self.get_postinstall_error() -# if self.abort: -# LOG.warn(_("Aborting after creation of template VM.")) -# LOG.warn(_("You are responsible yourself to cleaning up the VM!!!")) + self.get_postinstall_error() + if self.abort: + LOG.warn(_("Aborting after creation of template VM.")) + LOG.warn(_("You are responsible yourself to cleaning up the VM!!!")) # else: # self.post_install_tasks_ssh() # if self.postinstall_errors: @@ -610,9 +610,9 @@ class CrTplHandler(BaseHandler): ssh.set_missing_host_key_policy(paramiko.client.AutoAddPolicy()) LOG.debug(_("Connecting to {h!r}, port {p} as {u!r} per SSH ...").format( - h=self.config.template_vm, p=self.ssh_port, u=self.ssh_user)) + h=self.tpl_ip, p=self.ssh_port, u=self.ssh_user)) ssh.connect( - self.config.template_vm, port=self.ssh_port, timeout=self.ssh_timeout, + self.tpl_ip, port=self.ssh_port, timeout=self.ssh_timeout, username=self.ssh_user, key_filename=self.private_ssh_key) LOG.debug(_("Trying to read {!r} ...").format('/root/postinst-error.txt')) @@ -640,7 +640,7 @@ class CrTplHandler(BaseHandler): ssh.close() if self.postinstall_errors: - LOG.warn(_("Template VM {!r} has to be removed.").format(self.config.template_vm)) + LOG.warn(_("Template VM {!r} has to be removed.").format(self.tpl_ip)) # ------------------------------------------------------------------------- def post_install_tasks_ssh(self):