From 268cc90d2ffbfed6253c36d5abd0d243699e6a65 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 27 May 2020 16:48:33 +0200 Subject: [PATCH] Parsing for Cobbler version --- lib/cr_vmware_tpl/cobbler.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/cr_vmware_tpl/cobbler.py b/lib/cr_vmware_tpl/cobbler.py index 0af1df2..b4938d1 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.2' +__version__ = '0.2.3' LOG = logging.getLogger(__name__) @@ -159,8 +159,9 @@ class Cobbler(BaseHandler): proc = self.exec_cobbler('version', no_simulate=True) - cobbler_version = proc.stdout - LOG.info(_("Version of {} is:").format("Cobbler") + "\n{}".format(cobbler_version)) + first_line = proc.stdout.splitlines()[0] + cobbler_version = re.sub(r'^\s*cobbler\s+', '', first_line, re.IGNORECASE).strip() + LOG.info(_("Version of {} is:").format("Cobbler") + " {!r}".format(cobbler_version)) return cobbler_version -- 2.39.5