Allow device specification by node to udev.get_device. (#1524700)
This commit is contained in:
parent
fa9539ddcc
commit
bdf0896b09
@ -0,0 +1,32 @@
|
||||
From 39aa7041481f6e5cf954e67661f2cb55d43f9441 Mon Sep 17 00:00:00 2001
|
||||
From: David Lehman <dlehman@redhat.com>
|
||||
Date: Thu, 8 Mar 2018 11:40:48 -0500
|
||||
Subject: [PATCH] Allow device specification by node to udev.get_device.
|
||||
(#1524700)
|
||||
|
||||
---
|
||||
blivet/udev.py | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/blivet/udev.py b/blivet/udev.py
|
||||
index 6936a230..6eb7dab0 100644
|
||||
--- a/blivet/udev.py
|
||||
+++ b/blivet/udev.py
|
||||
@@ -56,9 +56,12 @@ def device_to_dict(device):
|
||||
return result
|
||||
|
||||
|
||||
-def get_device(sysfs_path):
|
||||
+def get_device(sysfs_path=None, device_node=None):
|
||||
try:
|
||||
- device = pyudev.Devices.from_sys_path(global_udev, sysfs_path)
|
||||
+ if sysfs_path is not None:
|
||||
+ device = pyudev.Devices.from_sys_path(global_udev, sysfs_path)
|
||||
+ elif device_node is not None:
|
||||
+ device = pyudev.Devices.from_device_file(global_udev, device_node)
|
||||
except pyudev.DeviceNotFoundError as e:
|
||||
log.error(e)
|
||||
result = None
|
||||
--
|
||||
2.14.3
|
||||
|
@ -14,7 +14,7 @@ Version: 3.0.0
|
||||
|
||||
%global prerelease .b1
|
||||
# prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2
|
||||
Release: 0.3%{?prerelease}%{?dist}
|
||||
Release: 0.4%{?prerelease}%{?dist}
|
||||
Epoch: 1
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
@ -23,6 +23,7 @@ Group: System Environment/Libraries
|
||||
Source0: http://github.com/storaged-project/blivet/archive/%{realname}-%{realversion}.tar.gz
|
||||
Patch0: 0001-Dasd-is-a-valid-label-type-on-s390x.patch
|
||||
Patch1: 0002-Do-not-try-to-update-potfile-during-make-all.patch
|
||||
Patch2: 0003-Allow-device-specification-by-node-to-udev.get_devic.patch
|
||||
|
||||
# Versions of required components (done so we make sure the buildrequires
|
||||
# match the requires versions of things).
|
||||
@ -165,6 +166,9 @@ make PYTHON=%{__python3} DESTDIR=%{buildroot} install
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Mar 12 2018 David Lehman <dlehman@redhat.com> - 1:3.0.0-0.4.b1
|
||||
- Allow device specification by node to udev.get_device. (#1524700)
|
||||
|
||||
* Tue Mar 06 2018 Vojtech Trefny <vtrefny@redhat.com> - 1:3.0.0-0.3.b1
|
||||
- Dasd is a valid label type on s390x (#1538550)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user