Comment 5 for bug 1829553

Revision history for this message
Cubic PPA (cubic-wizard) wrote :

SUMMARY
-------

To generate the list of available Kernels in Cubic, matching versions of both vmlinuz and initrd MUST be available.

There is a typo in the code so that the matching version of initrd is not checked correctly.

DETAILS
-------

In the function create_kernel_details_list() in utilities.py , kernel_details element #2 represents vmlinuz, and kernel_details element #4 represents initrd.

Line 2058 (in the function create_kernel_details_list() in utilities.py) should filter this list of kernels to include only kernels where BOTH vmlinuz and initrd are available.

However, this line erroneously checks vmlinuz twice:

    if kernel_details[2] and kernel_details[2]

Notice that element #2 (vmlinuz) is incorrectly repeated twice.

This misses checking for a valid initrd. As a result, kernels that are missing a matching initrd version may be included in the final list of valid kernels. In these cases, kernels will have initrd = `None`.

Ultimately, line 2089 tries to create the full path to an initrd file:

    initrd_filepath = os.path.join(directory, initrd_filename)

If initrd is `None`, due to the typo on line # 2058, an exception will result while creating the full path to the initrd file.

To avoid this issue, line 2058 should check BOTH vmliniz AND initrd:

    if kernel_details[2] and kernel_details[4]

Notice that element #2 (vmlinuz) and element #4 (initrd) are checked in the corrected version of this line.