]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
task/kernel: fix Depends: parsing for dependencies with "|" 1267/head
authorDan Mick <dan.mick@redhat.com>
Fri, 15 Mar 2019 23:14:24 +0000 (16:14 -0700)
committerDan Mick <dan.mick@redhat.com>
Fri, 15 Mar 2019 23:14:24 +0000 (16:14 -0700)
also make the "Checking kernel version...want" logmsg include quotes
for spotting problems more quickly

Signed-off-by: Dan Mick <dan.mick@redhat.com>
teuthology/task/kernel.py

index d29b2e8c5e16249df26254097812b898abde3536..60c613e41f6e9aac78e8bf9d9b957a83c62e3894 100644 (file)
@@ -172,7 +172,7 @@ def need_to_install(ctx, role, version):
                     or a sha1.
     """
     ret = True
-    log.info('Checking kernel version of {role}, want {ver}...'.format(
+    log.info('Checking kernel version of {role}, want "{ver}"...'.format(
              role=role, ver=version))
     uname_fp = StringIO()
     ctx.cluster.only(role).run(
@@ -1052,6 +1052,8 @@ def get_latest_image_version_deb(remote, ostype):
     output = StringIO()
     newest = ''
     # Depend of virtual package has uname -r output in package name. Grab that.
+    # Note that a dependency list may have multiple comma-separated entries,
+    # but also each entry may be an alternative (pkg1 | pkg2)
     if 'debian' in ostype:
         remote.run(args=['sudo', 'apt-get', '-y', 'install',
                          'linux-image-amd64'], stdout=output)
@@ -1088,6 +1090,10 @@ def get_latest_image_version_deb(remote, ostype):
                 newest = line.split('linux-image-')[1]
                 if ',' in newest:
                     newest = newest.split(',')[0]
+                if '|' in newest:
+                    # not strictly correct, as any of the |-joined
+                    # packages may satisfy the dependency
+                    newest = newest.split('|')[0].strip()
     output.close()
     return newest