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

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



> diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py
> index f2511b0..6ed68fe 100644
> --- a/src/pylorax/treebuilder.py
> +++ b/src/pylorax/treebuilder.py
> @@ -23,6 +23,7 @@ logger = logging.getLogger("pylorax.treebuilder")
>  import os, re
>  from os.path import basename, isdir
>  from subprocess import check_call, check_output
> +import sys
>  
>  from sysutils import joinpaths, remove
>  from shutil import copytree, copy2
> @@ -155,6 +156,9 @@ class TreeBuilder(object):
>          # 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)
> +        if len(isolabel) > 32:
> +            logger.fatal("the volume id cannot be longer than 32 characters")
> +            sys.exit(1)
>  
>          # NOTE: if you pass an arg named "runtime" to a mako template it'll
>          # clobber some mako internal variables - hence "runtime_img".

Have you started to do anything at this point?  If so, it'd be nicer to
check the length way up front, right at argument processing time.

- Chris


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