phase/kiwi, phase/image-builder: iso fields
The image-builder and kiwi phases did not implement the ISO-specific bits to store additional metadata (`implant_md5` and `volume_id`). This commit adds those inspections and sets the appropriate fields on the image object so these values show up in `images.json`. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
This commit is contained in:
parent
78a724467e
commit
ad1c3ed7e3
4 changed files with 28 additions and 4 deletions
|
|
@ -8,7 +8,7 @@ from productmd.images import Image
|
|||
from . import base
|
||||
from .. import util
|
||||
from ..linker import Linker
|
||||
from ..wrappers import kojiwrapper
|
||||
from ..wrappers import kojiwrapper, iso
|
||||
from .image_build import EXTENSIONS
|
||||
from ..threading import TelemetryWorkerThread as WorkerThread
|
||||
from ..image_checks import validate_image_sanity
|
||||
|
|
@ -246,6 +246,16 @@ class RunImageBuilderThread(WorkerThread):
|
|||
|
||||
img.bootable = format_ == "iso"
|
||||
img.subvariant = config.get("subvariant", variant.uid)
|
||||
|
||||
# For ISOs we need to store some additional information on the `Image`
|
||||
# object
|
||||
if format_ == "iso":
|
||||
img.implant_md5 = iso.get_implanted_md5(image_dest)
|
||||
try:
|
||||
img.volume_id = iso.get_volume_id(image_dest)
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
compose.im.add(variant=variant.uid, arch=arch, image=img)
|
||||
|
||||
validate_image_sanity(compose, arch, img, logger=self.pool._logger)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from productmd.images import Image
|
|||
from . import base
|
||||
from .. import util
|
||||
from ..linker import Linker
|
||||
from ..wrappers import kojiwrapper
|
||||
from ..wrappers import kojiwrapper, iso
|
||||
from .image_build import EXTENSIONS
|
||||
from ..threading import TelemetryWorkerThread as WorkerThread
|
||||
from ..image_checks import validate_image_sanity
|
||||
|
|
@ -253,6 +253,16 @@ class RunKiwiBuildThread(WorkerThread):
|
|||
# Kiwi produces only bootable ISOs. Other kinds of images are
|
||||
img.bootable = format_ == "iso"
|
||||
img.subvariant = config.get("subvariant", variant.uid)
|
||||
|
||||
# For ISOs we need to store some additional information on the `Image`
|
||||
# object
|
||||
if format_ == "iso":
|
||||
img.implant_md5 = iso.get_implanted_md5(image_dest)
|
||||
try:
|
||||
img.volume_id = iso.get_volume_id(image_dest)
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
compose.im.add(variant=variant.uid, arch=arch, image=img)
|
||||
|
||||
validate_image_sanity(compose, arch, img, logger=self.pool._logger)
|
||||
|
|
|
|||
|
|
@ -317,7 +317,8 @@ class TestImageBuilderThread(PungiTestCase):
|
|||
assert "Test" == image.subvariant
|
||||
assert not image.bootable
|
||||
|
||||
def test_process_iso(self, KojiWrapper, get_file_size, get_mtime, Linker):
|
||||
@mock.patch("pungi.phases.imagebuilder.iso")
|
||||
def test_process_iso(self, iso, KojiWrapper, get_file_size, get_mtime, Linker):
|
||||
img_name = "FCBG.{arch}-Rawhide-1.6.iso"
|
||||
self.repo = self.topdir + "/compose/Server/$arch/os"
|
||||
compose = DummyCompose(
|
||||
|
|
@ -413,6 +414,7 @@ class TestImageBuilderThread(PungiTestCase):
|
|||
assert "boot" == image.type
|
||||
assert image.bootable
|
||||
assert "Test" == image.subvariant
|
||||
assert image.implant_md5 == iso.get_implanted_md5.return_value
|
||||
|
||||
def test_handle_koji_fail(self, KojiWrapper, get_file_size, get_mtime, Linker):
|
||||
self.repo = self.topdir + "/compose/Server/$arch/os"
|
||||
|
|
|
|||
|
|
@ -362,7 +362,8 @@ class TestKiwiBuildThread(PungiTestCase):
|
|||
assert "Test" == image.subvariant
|
||||
assert not image.bootable
|
||||
|
||||
def test_process_iso(self, KojiWrapper, get_file_size, get_mtime, Linker):
|
||||
@mock.patch("pungi.phases.kiwibuild.iso")
|
||||
def test_process_iso(self, iso, KojiWrapper, get_file_size, get_mtime, Linker):
|
||||
img_name = "FCBG.{arch}-Rawhide-1.6.iso"
|
||||
self.repo = self.topdir + "/compose/Server/$arch/os"
|
||||
compose = DummyCompose(
|
||||
|
|
@ -472,6 +473,7 @@ class TestKiwiBuildThread(PungiTestCase):
|
|||
assert "live-kiwi" == image.type
|
||||
assert image.bootable
|
||||
assert "Test" == image.subvariant
|
||||
assert image.implant_md5 == iso.get_implanted_md5.return_value
|
||||
|
||||
def test_handle_koji_fail(self, KojiWrapper, get_file_size, get_mtime, Linker):
|
||||
self.repo = self.topdir + "/compose/Server/$arch/os"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue