[lorax] Don't emit media labels with spaces in them.

Peter Jones pjones at redhat.com
Mon Jun 30 20:44:45 UTC 2014


Spaces cause various bugs like #923374 and #855849 , and it would be
better if we just didn't use them.

Note that there's a corresponding pungi change to go with this.

Signed-off-by: Peter Jones <pjones at redhat.com>
---
 share/live/x86.tmpl        | 3 +++
 share/x86.tmpl             | 3 +++
 src/pylorax/__init__.py    | 2 +-
 src/sbin/livemedia-creator | 2 +-
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/share/live/x86.tmpl b/share/live/x86.tmpl
index 522c873..eb67bbf 100644
--- a/share/live/x86.tmpl
+++ b/share/live/x86.tmpl
@@ -6,6 +6,9 @@ PXEBOOTDIR="images/pxeboot"
 BOOTDIR="isolinux"
 KERNELDIR=PXEBOOTDIR
 LIVEDIR="LiveOS"
+
+## Don't allow spaces or escape characters in the iso label
+isolabel = ''.join(ch if ch.isalnum() else '-' for ch in isolabel)
 %>
 
 mkdir ${LIVEDIR}
diff --git a/share/x86.tmpl b/share/x86.tmpl
index a139596..cdd7477 100644
--- a/share/x86.tmpl
+++ b/share/x86.tmpl
@@ -6,6 +6,9 @@ PXEBOOTDIR="images/pxeboot"
 BOOTDIR="isolinux"
 KERNELDIR=PXEBOOTDIR
 LIVEDIR="LiveOS"
+
+## Don't allow spaces or escape characters in the iso label
+isolabel = ''.join(ch if ch.isalnum() else '-' for ch in isolabel)
 %>
 
 mkdir ${LIVEDIR}
diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py
index 952f08f..83f5286 100644
--- a/src/pylorax/__init__.py
+++ b/src/pylorax/__init__.py
@@ -242,7 +242,7 @@ class Lorax(BaseLoraxClass):
 
         # 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,
+        isolabel = volid or "{0.name}-{0.version}-{1.basearch}".format(self.product,
                                                                        self.arch)
 
         if len(isolabel) > 32:
diff --git a/src/sbin/livemedia-creator b/src/sbin/livemedia-creator
index 47eec2c..e5f4f77 100755
--- a/src/sbin/livemedia-creator
+++ b/src/sbin/livemedia-creator
@@ -557,7 +557,7 @@ def make_livecd(opts, mount_dir, work_dir):
         remove(fullpath)
     shutil.copytree(configdir, fullpath)
 
-    isolabel = opts.volid or "{0.name} {0.version} {1.basearch}".format(product, arch)
+    isolabel = opts.volid or "{0.name}-{0.version}-{1.basearch}".format(product, arch)
     if len(isolabel) > 32:
         isolabel = isolabel[:32]
         log.warn("Truncating isolabel to 32 chars: %s", isolabel)
-- 
1.9.3



More information about the anaconda-patches mailing list