From: Sandon Van Ness Date: Thu, 13 Mar 2014 23:02:04 +0000 (-0700) Subject: Make distro kernels work on Trusty. X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ba7465fcea5a8a89a3e56f22775dac0b387d74a8;p=teuthology.git Make distro kernels work on Trusty. Some grub changes and package names caused them to fail on trusty. Signed-off-by: Sandon Van Ness --- diff --git a/teuthology/task/kernel.py b/teuthology/task/kernel.py index cf6fc9372..efa73a23e 100644 --- a/teuthology/task/kernel.py +++ b/teuthology/task/kernel.py @@ -589,7 +589,13 @@ def install_distro_kernel(remote): menuentry = '' for line in grub2conf.split('\n'): if 'submenu' in line: - submenu = line.split('"')[1] + submenu = line.split('submenu ')[1] + # Ubuntu likes to be sneaky and change formatting of + # grub.cfg between quotes/doublequotes between versions + if submenu.startswith("'"): + submenu = submenu.split("'")[1] + if submenu.startswith('"'): + submenu = submenu.split('"')[1] if 'menuentry' in line: if newversion in line and 'recovery' not in line: menuentry = line.split('\'')[1] @@ -733,12 +739,18 @@ def get_version_from_pkg(remote, ostype): return newest #Ubuntu is a depend in a depend. if 'ubuntu' in ostype: - remote.run(args=['sudo', 'apt-get', '-y', 'install', 'linux-image-current-generic' ], stdout=output, stderr=err_mess ) - remote.run(args=['dpkg', '-s', 'linux-image-current-generic' ], stdout=output, stderr=err_mess ) - for line in output.getvalue().split('\n'): - if 'Depends:' in line: - depends = line.split('Depends: ')[1] - remote.run(args=['dpkg', '-s', depends ], stdout=output, stderr=err_mess ) + try: + remote.run(args=['sudo', 'apt-get', '-y', 'install', 'linux-image-current-generic' ], stdout=output, stderr=err_mess ) + remote.run(args=['dpkg', '-s', 'linux-image-current-generic' ], stdout=output, stderr=err_mess ) + for line in output.getvalue().split('\n'): + if 'Depends:' in line: + depends = line.split('Depends: ')[1] + remote.run(args=['dpkg', '-s', depends ], stdout=output, stderr=err_mess ) + except run.CommandFailedError: + # Non precise ubuntu machines (like trusty) don't have + # linux-image-current-generic so use linux-image-generic instead. + remote.run(args=['sudo', 'apt-get', '-y', 'install', 'linux-image-generic' ], stdout=output, stderr=err_mess ) + remote.run(args=['dpkg', '-s', 'linux-image-generic' ], stdout=output, stderr=err_mess ) for line in output.getvalue().split('\n'): if 'Depends:' in line: newest = line.split('linux-image-')[1]