[master 1/2] Make getDependentDevices work with hidden devices.
dwlehman
installerbot-noreply at redhat.com
Thu Apr 2 16:37:09 UTC 2015
From: David Lehman <dlehman at redhat.com>
---
blivet/devicetree.py | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 5a7aa0c..f645a9b 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -361,23 +361,30 @@ def processActions(self, dryRun=False, callbacks=None):
dryRun=dryRun,
callbacks=callbacks)
- def getDependentDevices(self, dep):
+ def getDependentDevices(self, dep, hidden=False):
""" Return a list of devices that depend on dep.
The list includes both direct and indirect dependents.
:param dep: the device whose dependents we are looking for
:type dep: :class:`~.devices.StorageDevice`
+ :keyword bool hidden: include hidden devices in search
"""
dependents = []
+ log_method_call(self, dep=dep, hidden=hidden)
# don't bother looping looking for dependents if this is a leaf device
- if dep.isleaf:
+ # XXX all hidden devices are leaves
+ if dep.isleaf and not hidden:
+ log.debug("dep is a leaf")
return dependents
- incomplete = [d for d in self._devices
- if not getattr(d, "complete", True)]
- for device in self.devices + incomplete:
+ devices = self._devices[:]
+ if hidden:
+ devices.extend(self._hidden)
+
+ for device in devices:
+ log.debug("checking if %s depends on %s", device.name, dep.name)
if device.dependsOn(dep):
dependents.append(device)
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/0fd7b79350d11fc6d8e1ad0b4f393a81b1db3e60
More information about the anaconda-patches
mailing list