[lorax 2/2] Check if the volume id is not longer than 32 chars (#786832)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a requirement of mkisofs.
Try to check it as soon as possible.
---
 src/pylorax/__init__.py    |   13 +++++++++++--
 src/pylorax/treebuilder.py |    6 +-----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py
index d842b0f..758d656 100644
--- a/src/pylorax/__init__.py
+++ b/src/pylorax/__init__.py
@@ -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"]
diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py
index f2511b0..683c2ec 100644
--- a/src/pylorax/treebuilder.py
+++ b/src/pylorax/treebuilder.py
@@ -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,
-- 
1.7.5.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux