neil / rpms / udisks2

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