Don't crash on generating volid without variant
First, this fixes the crash when volume id requires variant uid, but it is not specified. This happened in buildinstall phase. When lorax is used, it is run once for each variant, so we can actually specify the variant and get the correct variant. When using buildinstall, no volume id will be generated and pungi will possibly crash later on. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
1af17a5262
commit
770a81b76c
@ -130,6 +130,7 @@ class BuildinstallPhase(PhaseBase):
|
||||
|
||||
if buildinstall_method == "lorax":
|
||||
for variant in self.compose.get_variants(arch=arch, types=['variant']):
|
||||
volid = get_volid(self.compose, arch, variant=variant, disc_type="boot")
|
||||
commands.append(
|
||||
self._get_lorax_cmd(repo_baseurl, output_dir, variant, arch, buildarch, volid)
|
||||
)
|
||||
|
@ -347,9 +347,9 @@ def get_volid(compose, arch, variant=None, escape_spaces=False, disc_type=False)
|
||||
# iso = IsoWrapper(logger=compose._logger)
|
||||
# volid = iso._truncate_volid(volid)
|
||||
|
||||
if len(volid) > 32:
|
||||
if volid and len(volid) > 32:
|
||||
raise ValueError("Could not create volume ID <= 32 characters")
|
||||
|
||||
if escape_spaces:
|
||||
if volid and escape_spaces:
|
||||
volid = volid.replace(" ", r"\x20")
|
||||
return volid
|
||||
|
Loading…
Reference in New Issue
Block a user