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..fefef0c 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('Invalid layer name "%s" - Layer name can only include letters, numbers and dashes.', layer_name) + sys.exit(1) + if options.github_auth: if not ':' in options.github_auth: logger.error('--github-auth value must be specified as username:password') -- 1.9.1 -- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto