]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Parsing for Cobbler version
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 27 May 2020 14:48:33 +0000 (16:48 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 27 May 2020 14:48:33 +0000 (16:48 +0200)
lib/cr_vmware_tpl/cobbler.py

index 0af1df2c8dc790cb30090776fbcedda95b598fec..b4938d131537cb32b5f0f3ad4adde71317287999 100644 (file)
@@ -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