s390: Replace spaces and escape characters in isolabel with '-'

Resolves: RHEL-22658
This commit is contained in:
Brian C. Lane 2024-05-22 15:17:38 -07:00
parent a70ed02ee7
commit 9a2ec4fccf

View File

@ -1,4 +1,4 @@
<%page args="kernels, runtime_img, runtime_base, basearch, inroot, outroot"/>
<%page args="kernels, runtime_img, runtime_base, basearch, inroot, outroot, product, isolabel"/>
<%
configdir="tmp/config_files/s390"
BOOTDIR="images"
@ -9,6 +9,12 @@ MKS390IMAGE="/usr/bin/mk-s390image"
# The assumption seems to be that there is only one s390 kernel, ever
kernel = kernels[0]
## Don't allow spaces or escape characters in the iso label
def valid_label(ch):
return ch.isalnum() or ch == '_'
isolabel = ''.join(ch if valid_label(ch) else '-' for ch in isolabel)
import os
from os.path import basename
from pylorax.sysutils import joinpaths