Best Python code snippet using autotest_python
deb_kernel.py
Source:deb_kernel.py
...37 remote_filename = os.path.join(remote_tmpdir, basename)38 host.send_file(self.source_material, remote_filename)39 host.run('dpkg -i "%s"' % (utils.sh_escape(remote_filename),))40 host.run('mkinitramfs -o "%s" "%s"' % (41 utils.sh_escape(self.get_initrd_name()),42 utils.sh_escape(self.get_version()),))43 host.bootloader.add_kernel(self.get_image_name(),44 initrd=self.get_initrd_name(), **kwargs)45 def get_version(self):46 """Get the version of the kernel to be installed.47 Returns:48 The version string, as would be returned49 by 'make kernelrelease'.50 Raises:51 AutoservError: no package has yet been obtained. Call52 DEBKernel.get() with a .deb package.53 """54 if self.source_material is None:55 raise error.AutoservError("A kernel must first be "56 "specified via get()")57 retval= utils.run('dpkg-deb -f "%s" version' %58 utils.sh_escape(self.source_material),)59 return retval.stdout.strip()60 def get_image_name(self):61 """Get the name of the kernel image to be installed.62 Returns:63 The full path to the kernel image file as it will be64 installed on the host.65 Raises:66 AutoservError: no package has yet been obtained. Call67 DEBKernel.get() with a .deb package.68 """69 return "/boot/vmlinuz-%s" % (self.get_version(),)70 def get_initrd_name(self):71 """Get the name of the initrd file to be installed.72 Returns:73 The full path to the initrd file as it will be74 installed on the host. If the package includes no75 initrd file, None is returned76 Raises:77 AutoservError: no package has yet been obtained. Call78 DEBKernel.get() with a .deb package.79 """80 if self.source_material is None:81 raise error.AutoservError("A kernel must first be "82 "specified via get()")83 return "/boot/initrd.img-%s" % (self.get_version(),)84 def extract(self, host):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!