[blivet:rhel7/master 7/8] Add hidden flag to devicetree.getDeviceByID (#1043763)

mulhern amulhern at redhat.com
Mon Mar 3 21:33:45 UTC 2014


Related: rbhz#1043763

Similar to devicetree.getDeviceByLabel, etc.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/devicetree.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 0fdffdb..2afca40 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -2214,8 +2214,13 @@ 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:
+    def getDeviceByID(self, id_num, hidden=False):
+
+        devices = self._devices[:]
+        if hidden:
+            devices += self._hidden
+
+        for device in devices:
             if device.id == id_num:
                 return device
 
-- 
1.8.3.1



More information about the anaconda-patches mailing list