Needs Fixing: [PATCH autotest-client-tests] UBUNTU: SAUCE: ubuntu_boot: implement revocation list checks

Krzysztof Kozlowski krzysztof.kozlowski at canonical.com
Thu Jul 29 06:53:56 UTC 2021


On 29/07/2021 03:39, Sean Feole wrote:
> This feature looks like a great addition, however, giving how critical
> the ubuntu_boot a-c-t is (This test is now a gate for initial kernel
> builds), we need to be careful how we update it.
> 
> Upon testing this patch against a test harness using Focal amd64 vm:
> 
> 
> 01:08:17 INFO | START ubuntu_boot.kernel_revocation_list
> ubuntu_boot.kernel_revocation_list timestamp=1627520897 timeout=300
> localtime=Jul 29 01:08:17 01:08:17 DEBUG| Persistent state
> client._record_indent now set to 2 01:08:17 DEBUG| Persistent state
> client.unexpected_reboot now set to
> ('ubuntu_boot.kernel_revocation_list',
> 'ubuntu_boot.kernel_revocation_list') 01:08:17 DEBUG| Waiting for pid
> 2357 for 300 seconds 01:08:17 WARNI| System python is too old, crash
> handling disabled 01:08:17 ERROR| Exception escaping from test:
> Traceback (most recent call last): File
> "/home/ubuntu/autotest/client/shared/test.py", line 411, in _exec
> _call_test_function(self.execute, *p_args, **p_dargs) File
> "/home/ubuntu/autotest/client/shared/test.py", line 830, in
> _call_test_function raise error.UnhandledTestFail(e) UnhandledTestFail:
> Unhandled AttributeError: 'tuple' object has no attribute 'release'
> Traceback (most recent call last): File
> "/home/ubuntu/autotest/client/shared/test.py", line 823, in
> _call_test_function return func(*args, **dargs) File
> "/home/ubuntu/autotest/client/shared/test.py", line 291, in execute
> postprocess_profiled_run, args, dargs) File
> "/home/ubuntu/autotest/client/shared/test.py", line 212, in
> _call_run_once self.run_once(*args, **dargs) File
> "/home/ubuntu/autotest/client/tests/ubuntu_boot/ubuntu_boot.py", line
> 97, in run_once self.kernel_revocation_list() File
> "/home/ubuntu/autotest/client/tests/ubuntu_boot/ubuntu_boot.py", line
> 60, in kernel_revocation_list config_file = "/boot/config-" +
> os.uname().release AttributeError: 'tuple' object has no attribute 'release'
> 
> Full output here: https://pastebin.canonical.com/p/Zr2jjzsNcr/
> 
> Unfortunately autotest only supports python2, which is why this dumped
> an Exception, there is no os.uname().release. I think the best way to
> handle this:
> 
> 1.) Re-write it all for python2 (no one wants to do that)
> 
> 2.) Isolate the function into it's own py3 script and call it from
> ubuntu_boot.py using something like, utils.system('python3
> <my_python3_script>' ).
> 
> This is probably the easiest, any errors that are returned from the
> python3 script can be handled in "ubuntu_boot.py" using the
> autotest.client library.
> 

"release" as part of tuple is provided in Python2 and Python3 for
backwards compatibility also provides a tuple, so this can be simply old
Python2 code.

Other popular option for such older code is to wrap it and handle both
cases:

get_os_uname_release():
    try:
        return os.uname().release
    except AttributeError:
        # Do the old style

This is quite common pattern for imports which are different between 2
and 3.

Best regards,
Krzysztof



More information about the kernel-team mailing list