From: Frank Brehm Date: Wed, 27 May 2020 14:38:57 +0000 (+0200) Subject: Bugfixing X-Git-Tag: 2.1.2^2~9^2~31^2~109 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=cf2f50626f1fb9cc60d9dbdc3b7931d4c6e423b2;p=pixelpark%2Fcreate-vmware-tpl.git Bugfixing --- diff --git a/lib/cr_vmware_tpl/cobbler.py b/lib/cr_vmware_tpl/cobbler.py index f32d7b0..0af1df2 100644 --- a/lib/cr_vmware_tpl/cobbler.py +++ b/lib/cr_vmware_tpl/cobbler.py @@ -31,7 +31,7 @@ from .config import CrTplConfiguration from .xlate import XLATOR -__version__ = '0.2.1' +__version__ = '0.2.2' LOG = logging.getLogger(__name__) @@ -107,6 +107,7 @@ class Cobbler(BaseHandler): cmds.append(c) ssh = None + proc = None try: @@ -142,9 +143,15 @@ class Cobbler(BaseHandler): proc = CompletedProcess(cmds, retcode, output, err, start_dt=start_dt, end_dt=end_dt) - if self.verbose > 2: - LOG.debug(_("Completed SSH process:") + "\n{}".format(proc)) - return proc + finally: + if ssh: + if self.verbose > 2: + LOG.debug(_("Closing SSH connection.")) + ssh.close() + + if self.verbose > 2: + LOG.debug(_("Completed SSH process:") + "\n{}".format(proc)) + return proc # ------------------------------------------------------------------------- def get_cobbler_version(self):