neil / rpms / udisks2

Forked from rpms/udisks2 a year ago
Clone
55fc26
From 6ad2d39f31e9efbbd0ab4f48e5796e9d0485c59f Mon Sep 17 00:00:00 2001
55fc26
From: Vojtech Trefny <vtrefny@redhat.com>
55fc26
Date: Thu, 2 Nov 2017 14:00:12 +0100
55fc26
Subject: [PATCH] Fix checking for distribution and version in integration
55fc26
 tests
55fc26
55fc26
And also don't try to run the tests if we fail to detect the
55fc26
distribution and/or version.
55fc26
55fc26
Resolves: rhbz#1508385
55fc26
---
55fc26
 src/tests/integration-test | 6 +++++-
55fc26
 1 file changed, 5 insertions(+), 1 deletion(-)
55fc26
55fc26
diff --git a/src/tests/integration-test b/src/tests/integration-test
55fc26
index 019a8dc..44ddec5 100755
55fc26
--- a/src/tests/integration-test
55fc26
+++ b/src/tests/integration-test
55fc26
@@ -1747,7 +1747,11 @@ class MDRaid(UDisksTestCase):
55fc26
 def get_distro_version():
55fc26
     # 3rd to 6th fields from e.g. "CPE OS Name: cpe:/o:fedoraproject:fedora:27" or "CPE OS Name: cpe:/o:centos:centos:7"
55fc26
     out = subprocess.check_output('hostnamectl status | grep "CPE OS Name"', shell=True).decode().strip()
55fc26
-    _project, distro, version = tuple(out.split(":")[3:65])
55fc26
+    try:
55fc26
+        _project, distro, version = tuple(out.split(":")[3:6])
55fc26
+    except ValueError:
55fc26
+        print('Failed to get distribution and version from "%s". Aborting.' % out)
55fc26
+        sys.exit(1)
55fc26
 
55fc26
     return (distro, version)
55fc26
 
55fc26
-- 
55fc26
1.8.3.1
55fc26