from teuthology import misc as teuthology
from ..orchestra import run
from ..config import config as teuth_config
+from ..exceptions import UnsupportedPackageTypeError
log = logging.getLogger(__name__)
],
)
+def gitbuilder_pkg_name(remote):
+ if remote.os.package_type == 'rpm':
+ pkg_name = 'kernel.x86_64.rpm'
+ elif remote.os.package_type == 'deb':
+ pkg_name = 'linux-image.deb'
+ else:
+ raise UnsupportedPackageTypeError(remote)
+ return pkg_name
+
+def remote_pkg_path(remote):
+ """
+ This is where kernel packages are copied over (in case of local
+ packages) or downloaded to (in case of gitbuilder packages) and
+ then installed from.
+ """
+ return os.path.join('/tmp', gitbuilder_pkg_name(remote))
+
def download_kernel(ctx, config):
"""
Download a Debian kernel and copy the assocated linux image.
args=[
'python', '-c',
'import shutil, sys; shutil.copyfileobj(sys.stdin, file(sys.argv[1], "wb"))',
- '/tmp/linux-image.deb',
+ remote_pkg_path(role_remote),
],
wait=False,
stdin=f
log.info('fetching kernel from {url}'.format(url=deb_url))
proc = role_remote.run(
args=[
- 'sudo', 'rm', '-f', '/tmp/linux-image.deb',
+ 'rm', '-f', remote_pkg_path(role_remote),
run.Raw('&&'),
'echo',
- 'linux-image.deb',
+ gitbuilder_pkg_name(role_remote),
run.Raw('|'),
'wget',
'-nv',
'-O',
- '/tmp/linux-image.deb',
+ remote_pkg_path(role_remote),
'--base={url}'.format(url=deb_url),
'--input-file=-',
],
'sudo',
'dpkg',
'-i',
- '/tmp/linux-image.deb',
+ remote_pkg_path(role_remote),
],
)
# extract the actual boot image name from the deb
'dpkg-deb',
'--fsys-tarfile',
- '/tmp/linux-image.deb',
+ remote_pkg_path(role_remote),
run.Raw('|'),
'tar',
'-t',
'update-grub',
run.Raw('&&'),
'rm',
- '/tmp/linux-image.deb',
+ remote_pkg_path(role_remote),
run.Raw('&&'),
'sudo',
'shutdown',