neil / rpms / udisks2

Forked from rpms/udisks2 a year ago
Clone

Blame SOURCES/udisks-2.10.0-tests-no-dev_disk-by-path.patch

830394
From 1358d1e5208d71d5a70f17a242eda00f079a9d0b Mon Sep 17 00:00:00 2001
830394
From: Tomas Bzatek <tbzatek@redhat.com>
830394
Date: Thu, 22 Apr 2021 18:20:48 +0200
830394
Subject: [PATCH 2/2] tests: Handle missing /dev/disk/by-path gracefully
830394
830394
Limited testing environments may not have this path always available.
830394
---
830394
 src/tests/dbus-tests/test_drive_ata.py | 19 +++++++++++--------
830394
 1 file changed, 11 insertions(+), 8 deletions(-)
830394
830394
diff --git a/src/tests/dbus-tests/test_drive_ata.py b/src/tests/dbus-tests/test_drive_ata.py
830394
index e91bd02f..37740c60 100644
830394
--- a/src/tests/dbus-tests/test_drive_ata.py
830394
+++ b/src/tests/dbus-tests/test_drive_ata.py
830394
@@ -20,14 +20,17 @@ DISK_PATH = "/dev/disk/by-path/"
830394
 
830394
 def _get_sata_disks():
830394
     sata_disks = []
830394
-    by_path = os.listdir(DISK_PATH)
830394
-    for dev in by_path:
830394
-        if "ata" in dev and "part" not in dev:
830394
-            path = os.path.realpath(os.path.join(DISK_PATH, dev))
830394
-            name = os.path.basename(path)
830394
-            if name.startswith("sd"):
830394
-                # ignore devices like CD drives etc.
830394
-                sata_disks.append(name)
830394
+    try:
830394
+        by_path = os.listdir(DISK_PATH)
830394
+        for dev in by_path:
830394
+            if "ata" in dev and "part" not in dev:
830394
+                path = os.path.realpath(os.path.join(DISK_PATH, dev))
830394
+                name = os.path.basename(path)
830394
+                if name.startswith("sd"):
830394
+                    # ignore devices like CD drives etc.
830394
+                    sata_disks.append(name)
830394
+    except:
830394
+        pass
830394
     return sata_disks
830394
 
830394
 
830394
-- 
830394
2.30.2
830394