[PATCH 09/21] Add a method to retrieve a devicetree device by id number.

David Lehman dlehman at redhat.com
Thu Aug 9 19:28:28 UTC 2012


---
 pyanaconda/storage/devicetree.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
index 4d317c9..24572ad 100644
--- a/pyanaconda/storage/devicetree.py
+++ b/pyanaconda/storage/devicetree.py
@@ -2078,6 +2078,11 @@ class DeviceTree(object):
     def getDevicesByInstance(self, device_class):
         return [d for d in self._devices if isinstance(d, device_class)]
 
+    def getDeviceByID(self, id_num):
+        for device in self._devices:
+            if device.id == id_num:
+                return device
+
     @property
     def devices(self):
         """ List of device instances """
-- 
1.7.7.6



More information about the anaconda-patches mailing list