layerindexlib: restapi.py: fix unbound variable
PATCH 1/1 layerindexlib: restapi.py: fix unbound variable
If the requested branch(es) is not found, a debugging message is displayed to list it, so the expected behavior is something like this:
$ bitbake-layers layerindex-fetch meta-firefox NOTE: Starting bitbake server... Loading https://layers.openembedded.org/layerindex/api/;branch=wrynose... ERROR: Remote layer index ['https://layers.openembedded.org/layerindex/'] is empty for branches ['wrynose']
However, the variable currently used is unbound, and the error below comes up:
File "/src/bitbake/lib/layerindexlib/restapi.py", line 216, in load_index_web
logger.debug("No valid branches (%s) found at url %s." % (branch, url))
^^^^^^
UnboundLocalError: cannot access local variable 'branch' where it is not associated with a value
Replace 'branch' by 'branches' to fix this.
Signed-off-by João Marcos Costa <[email protected]>
--- lib/layerindexlib/restapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/layerindexlib/restapi.py +1 -1
@@ -213,7 +213,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin): pindex['branches'] = _get_json_response(index.apilinks['branches'] + filter, username=up.username, password=up.password) if not pindex['branches']: - logger.debug("No valid branches (%s) found at url %s." % (branch, url)) + logger.debug("No valid branches (%s) found at url %s." % (branches, url)) return index index.add_raw_element("branches", layerindexlib.Branch, pindex['branches'])
Signature · 1 line
2.47.0