virtualization/verify_lxd need update to test on ubuntu core

Bug #1918400 reported by Betty Lin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox Provider - Base
Expired
Undecided
Unassigned

Bug Description

virtualization/verify_lxd need update to test on ubuntu core
Now it will be failed because it can't execute 'apt-cache'

Log:
https://certification.canonical.com/hardware/202012-28532/submission/205707/test/68747/result/17196123/

Revision history for this message
Jeff Lane  (bladernr) wrote :

DEBUG:root:Executing LXD Test
Traceback (most recent call last):
  File "/tmp/nest-0afhlxc2.460ec11461e5ca7de0e0e007ae263fcf4342ba90cf2e32ea21c373216a8e9690/virtualization.py", line 957, in <module>
    sys.exit(main())
  File "/tmp/nest-0afhlxc2.460ec11461e5ca7de0e0e007ae263fcf4342ba90cf2e32ea21c373216a8e9690/virtualization.py", line 950, in main
    args.func(args)
  File "/tmp/nest-0afhlxc2.460ec11461e5ca7de0e0e007ae263fcf4342ba90cf2e32ea21c373216a8e9690/virtualization.py", line 852, in test_lxd
    lxd_test = LXDTest(template, rootfs)
  File "/tmp/nest-0afhlxc2.460ec11461e5ca7de0e0e007ae263fcf4342ba90cf2e32ea21c373216a8e9690/virtualization.py", line 661, in __init__
    self.os_version = lsb_release.get_distro_information()["RELEASE"]
  File "/snap/checkbox-elgin/8/checkbox-runtime/usr/lib/python3/dist-packages/lsb_release.py", line 398, in get_distro_information
    distinfo = guess_debian_release()
  File "/snap/checkbox-elgin/8/checkbox-runtime/usr/lib/python3/dist-packages/lsb_release.py", line 332, in guess_debian_release
    rinfo = guess_release_from_apt()
  File "/snap/checkbox-elgin/8/checkbox-runtime/usr/lib/python3/dist-packages/lsb_release.py", line 237, in guess_release_from_apt
    releases = parse_apt_policy()
  File "/snap/checkbox-elgin/8/checkbox-runtime/usr/lib/python3/dist-packages/lsb_release.py", line 216, in parse_apt_policy
    policy = subprocess.Popen(['apt-cache','policy'],
  File "/snap/checkbox-elgin/8/checkbox-runtime/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/snap/checkbox-elgin/8/checkbox-runtime/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'apt-cache'

That is a problem in the lsb_release module where it uses apt-cache to guess certain things.

You'll need to wrap this in a try/except block and find a different way to determine the OS release on Core...

651 class LXDTest(object):
652
653 def __init__(self, template=None, rootfs=None):
654 self.rootfs_url = rootfs
655 self.template_url = template
656 self.rootfs_tarball = None
657 self.template_tarball = None
658 self.name = 'testbed'
659 self.image_alias = uuid4().hex
660 self.default_remote = "ubuntu:"
661 self.os_version = lsb_release.get_distro_information()["RELEASE"]

You'd need to wrap line 661 in a try/except block and fall over to whatever mechanism exists in core to determine the release information typicall provided by lsb_release.

Revision history for this message
Jeff Lane  (bladernr) wrote :

Actually, a better solution, IMO would be to start building a library in checkbox-support that will handle this and can be imported whenever it's needed.

Revision history for this message
Maksim Beliaev (beliaev-maksim) wrote :

Bug was migrated to GitHub: https://github.com/canonical/checkbox/issues/179.
Bug is no more monitored here.

Changed in plainbox-provider-checkbox:
status: New → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.