Check if the volume id is not longer than 32 chars (#786832)

This is a requirement of mkisofs.
Try to check it as soon as possible.
This commit is contained in:
Martin Gracik 2012-02-17 10:53:18 +01:00
parent 20fa29b32b
commit 524dfa28db
2 changed files with 12 additions and 7 deletions

View File

@ -181,6 +181,15 @@ class Lorax(BaseLoraxClass):
self.product = product
logger.debug("product data: %s" % product)
# NOTE: if you change isolabel, you need to change pungi to match, or
# the pungi images won't boot.
isolabel = volid or "{0.name} {0.version} {1.basearch}".format(self.product,
self.arch)
if len(isolabel) > 32:
logger.fatal("the volume id cannot be longer than 32 characters")
sys.exit(1)
templatedir = self.conf.get("lorax", "sharedir")
# NOTE: rb.root = ybo.conf.installroot (== self.inroot)
rb = RuntimeBuilder(product=self.product, arch=self.arch,
@ -235,8 +244,8 @@ class Lorax(BaseLoraxClass):
logger.info("preparing to build output tree and boot images")
treebuilder = TreeBuilder(product=self.product, arch=self.arch,
inroot=installroot, outroot=self.outputdir,
runtime=runtime, templatedir=templatedir,
volid=volid)
runtime=runtime, isolabel=isolabel,
templatedir=templatedir)
logger.info("rebuilding initramfs images")
dracut_args=["--xz", "--add", "livenet", "--add", "convertfs", "--omit", "plymouth"]

View File

@ -151,11 +151,7 @@ class RuntimeBuilder(object):
class TreeBuilder(object):
'''Builds the arch-specific boot images.
inroot should be the installtree root (the newly-built runtime dir)'''
def __init__(self, product, arch, inroot, outroot, runtime, templatedir=None, volid=None):
# NOTE: if you change isolabel, you need to change pungi to match, or
# the pungi images won't boot.
isolabel = volid or "{0.name} {0.version} {1.basearch}".format(product, arch)
def __init__(self, product, arch, inroot, outroot, runtime, isolabel, templatedir=None):
# NOTE: if you pass an arg named "runtime" to a mako template it'll
# clobber some mako internal variables - hence "runtime_img".
self.vars = DataHolder(arch=arch, product=product, runtime_img=runtime,