Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
log.debug("Checking %s", what)
if not isys.isIsoImage(what):
continue
log.debug("Mounting %s on %s", what, mount_path)
try:
blivet.util.mount(what, mount_path, fstype="iso9660", options="ro")
except OSError:
continue
if not os.access(discinfo_path, os.R_OK):
blivet.util.umount(mount_path)
continue
log.debug("Reading .discinfo")
disc_info = DiscInfo()
# TODO replace next 2 blocks with:
# pyanaconda.modules.payloads.source.utils.is_valid_install_disk
try:
disc_info.load(discinfo_path)
disc_arch = disc_info.arch
except Exception as ex: # pylint: disable=broad-except
log.warning(".discinfo file can't be loaded: %s", ex)
continue
log.debug("discArch = %s", disc_arch)
if disc_arch != arch:
log.warning("Architectures mismatch in find_first_iso_image: %s != %s",
disc_arch, arch)
blivet.util.umount(mount_path)
continue