From a4150b2fd416ce18fa2008329264948c114a832d Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 6 May 2019 16:12:27 -0700 Subject: [PATCH] Replace isoinfo with pycdlib isoinfo is part of genisoimage, which we no longer use, switch to using a python library to read the label from the iso. --- lorax.spec | 1 + src/pylorax/mount.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lorax.spec b/lorax.spec index 78ce32c2..2c163c78 100644 --- a/lorax.spec +++ b/lorax.spec @@ -49,6 +49,7 @@ Requires: python3-mako Requires: python3-kickstart >= 3.19 Requires: python3-dnf >= 3.2.0 Requires: python3-librepo +Requires: python3-pycdlib %if 0%{?fedora} # Fedora specific deps diff --git a/src/pylorax/mount.py b/src/pylorax/mount.py index 785a81fa..d8e2b1da 100644 --- a/src/pylorax/mount.py +++ b/src/pylorax/mount.py @@ -21,9 +21,10 @@ import logging log = logging.getLogger("livemedia-creator") import os +import pycdlib +from pycdlib.pycdlibexception import PyCdlibException from pylorax.imgutils import mount, umount -from pylorax.executils import execWithCapture class IsoMountpoint(object): """ @@ -94,9 +95,9 @@ class IsoMountpoint(object): Sets self.label if one is found """ - isoinfo_output = execWithCapture("isoinfo", ["-d", "-i", self.iso_path]) - log.debug(isoinfo_output) - for line in isoinfo_output.splitlines(): - if line.startswith("Volume id: "): - self.label = line[11:] - return + try: + iso = pycdlib.PyCdlib() + iso.open(self.iso_path) + self.label = iso.pvd.volume_identifier.decode("UTF-8").strip() + except PyCdlibException as e: + log.error("Problem reading label from %s: %s", self.iso_path, e)