On Mon, 26 Sep 2016 14:25:30 Liam R. Howlett wrote:
> Django will produce a cryptic error message if layers are added with
> invalid names.  Sanitize the layer names when trying to add them.
> 
> Signed-off-by: Liam R. Howlett <liam.howl...@windriver.com>
> ---
>  layerindex/tools/import_layer.py | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/layerindex/tools/import_layer.py
> b/layerindex/tools/import_layer.py index 9b5da22..8d9e8cb 100755
> --- a/layerindex/tools/import_layer.py
> +++ b/layerindex/tools/import_layer.py
> @@ -181,6 +181,8 @@ def get_github_layerinfo(layer_url, username = None,
> password = None):
> 
> 
>  def main():
> +    valid_layer_name = re.compile('[-\w]+$')
> +
>      parser = optparse.OptionParser(
>          usage = """
>      %prog [options] <url> [name]""")
> @@ -222,6 +224,10 @@ def main():
>              if layer_name.endswith('.git'):
>                  layer_name = layer_name[:-4]
> 
> +    if not valid_layer_name.match(layer_name):
> +            logger.error('Invlaid layer name "%s" -  Layer name can only
> include letters, numbers and dashes.', layer_name) 
> +            sys.exit(1)

Typo "Invlaid", and the indenting is out here too.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre
-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to