Bug 12887

Summary: [QA 2.5.1.rc1 ][Toaster]:Search for rpi-basic-image, click on 'add layer' button
Product: [Build System, Metadata & Runtime] Toaster Reporter: Manish Das <manish.das>
Component: toasterAssignee: David Reyna <david.reyna>
Status: RESOLVED FIXED QA Contact: Toaster default assignee <toaster>
Severity: normal    
Priority: Medium CC: akuster, jessica.zhang, stanciux.mihail
Version: 2.5.1   
Target Milestone: 2.6 M4   
Hardware: x86   
OS: Multiple   
Whiteboard: Backport
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Screenshot for 1428 test case none

Description Manish Das 2018-08-14 10:25:59 UTC
Created attachment 4360 [details]
Screenshot for 1428 test case

Steps to reproduce:
1. Access a project page, either by creating a new project or accessing an existing project from the "All projects" table. 

2. On the project page click on the "New custom image" link situated on the left-hand side, near Configuration, builds, import layer

3. Search for rpi-basic-image, click on 'add layer' button. Make sure a "layer added" notification shows and a "customise" button is displayed. Click the "customise" button, type a name for you new custom image and click on create custom image.

Expected Results:
It should create custom image

Actual results: 
While adding layer itself its not adding .Clicked on layer  and added  layer  from that.
Come back to recipe then click on customize button.Type a name for your new custom image and click on create custom image.
Its not going ahead after this.
Please check attached screen shot.

Regression Results:Tried with 2.6 M2 rc1 release facing same behavior but was passed earlier.
Comment 1 Armin Kuster 2018-08-17 17:15:58 UTC
shouldn't this now be against 2.6 with backport in the whiteboard?
Comment 2 David Reyna 2018-08-18 06:55:53 UTC
Hi Armin,

> shouldn't this now be against 2.6

I have set this for YP-2.6 M4.

I have not seen the term "backport in the whiteboard" before. Is there a standard practice of adding comments to the Whiteboard field? I had not been taught that.

- David
Comment 3 David Reyna 2018-09-30 10:33:10 UTC
I see two problems.

1) The "Add Layer" button does not seem to work. I can get around that by pre-adding the parent layer before making the custom image.

2) The observed freeze in the create image dialog box.

The freeze is due to a crash in Toaster:

vvvvvvvvvvvvvvvvvvvvvvvvvvv
30/Sep/2018 03:24:12] "GET /toastergui/project/3/newcustomimage/?format=json&limit=25&page=1&orderby=name&filter=&search=rpi-basic-image&default_orderby=name HTTP/1.1" 200 5359
2018-09-30 03:24:31,011 ERROR Internal Server Error: /toastergui/xhr_customrecipe/
Traceback (most recent call last):
  File "/folk/dreyna/.local/lib/python3.4/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/folk/dreyna/.local/lib/python3.4/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/folk/dreyna/.local/lib/python3.4/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/folk/dreyna/.local/lib/python3.4/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/dreyna/toaster-2.6-devel/poky/bitbake/lib/toaster/toastergui/api.py", line 680, in post
    recipef.write(recipe.generate_recipe_file_contents())
  File "/opt/dreyna/toaster-2.6-devel/poky/bitbake/lib/toaster/orm/models.py", line 1754, in generate_recipe_file_contents
    base_recipe_path)
OSError: Based on recipe file not found: None
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Comment 4 David Reyna 2018-10-01 00:05:06 UTC
ROOT CAUSE:
  The desired base image recipe 'rpi-basic-image' is part of the newly added layer 'meta-raspberrypi'. However, Toaster does not actively clone added layers until a build step. This leads to a path error when Toaster tries to read the recipe information from that missing layer directory.

WORKAROUND:
  After adding the parent layer (e.g. 'meta-raspberrypi') do any target build, for example "quilt-native". This triggers the cloning action. After this, the new custom recipe will work.
Comment 5 David Reyna 2018-10-04 06:17:24 UTC
Patch prepared for master (2.6).

The same patch should cherry-pick and apply to Sumo.
Comment 6 David Reyna 2018-10-04 15:20:31 UTC
New behavior:

1) The "Add Layer" button now works, just as it does for the Layers page.

2) If the parent image recipe is in a layer that is not yet cloned (and therefore that recipe file does not yet exist locally), the dialog will now display an error message with the advice to build any target (e.g. quilt-native) to force the layer cloning and then re-try to customize that recipe.

In the future, I can add a button titled "Clone layer" between "Add layer" and "Customize" states so that the user can explicitly get the selected layer cloned and thus continue with the workflow. The functionality for explicitly cloning pending layers was added recently with #12823.
Comment 7 David Reyna 2018-10-16 18:54:57 UTC
commit fa8ade3695b836fb788c57c0d56b546b47f1603a