]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Make distro kernels work on Trusty.
authorSandon Van Ness <sandon@inktank.com>
Thu, 13 Mar 2014 23:02:04 +0000 (16:02 -0700)
committerSandon Van Ness <sandon@inktank.com>
Fri, 14 Mar 2014 18:14:43 +0000 (11:14 -0700)
Some grub changes and package names caused them to fail on trusty.

Signed-off-by: Sandon Van Ness <sandon@inktank.com>
teuthology/task/kernel.py

index cf6fc937218b69b9252f5398b14c8e7e237656b0..efa73a23e602c6c688d954d2b94e280e8fe5524a 100644 (file)
@@ -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]