[anaconda][master/rhel7-branch] Get rid of instances of devicetree.getDevicesByType (#1228334)
Samantha N. Bueno
sbueno+anaconda at redhat.com
Thu Jun 4 16:04:26 UTC 2015
These functions are being removed in blivet since there is no great
benefit to keeping them around.
Resolves: rhbz#1228334
---
anaconda | 3 ++-
pyanaconda/image.py | 7 ++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/anaconda b/anaconda
index 360d5ad..d0e2b61 100755
--- a/anaconda
+++ b/anaconda
@@ -164,7 +164,8 @@ def exitHandler(rebootData, storage, exitCode=None):
from pyanaconda.iutil import dracut_eject, get_mount_paths
if flags.eject or rebootData.eject:
- for cdrom in storage.devicetree.getDevicesByType("cdrom"):
+ cdrom = [d for d in storage.devicetree.devices if d.type == "cdrom"]
+ for d in cdrom:
if get_mount_paths(cdrom.path):
dracut_eject(cdrom.path)
diff --git a/pyanaconda/image.py b/pyanaconda/image.py
index 9662832..d87fa33 100644
--- a/pyanaconda/image.py
+++ b/pyanaconda/image.py
@@ -191,8 +191,8 @@ def opticalInstallMedia(devicetree):
# Search for devices identified as cdrom along with any other
# device that has an iso9660 filesystem. This will catch USB media
# created from ISO images.
- for dev in set(devicetree.getDevicesByType("cdrom") + \
- [d for d in devicetree.devices if d.format.type == "iso9660"]):
+ optdevs = [d for d in devicetree.devices if d.type == "cdrom"]
+ for dev in set(optdevs + [d for d in devicetree.devices if d.format.type == "iso9660"]):
if not dev.controllable:
continue
@@ -224,7 +224,8 @@ def opticalInstallMedia(devicetree):
# Return a list of Device instances that may have HDISO install media
# somewhere. Candidate devices are simply any that we can mount.
def potentialHdisoSources(devicetree):
- return filter(lambda d: d.format.exists and d.format.mountable, devicetree.getDevicesByType("partition"))
+ parts = (d for d in devicetree.devices if isinstance(d, blivet.devices.PartitionDevice))
+ return filter(parts, key=lambda d: d.format.exists and d.format.mountable)
def umountImage(tree):
if os.path.ismount(tree):
--
1.9.3
More information about the anaconda-patches
mailing list