From e86d17a13c26a57b8745b1951dace73ae6372de9 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Tue, 27 Jan 2009 20:09:08 -1000 Subject: Syntax changes for the new pyparted. 1) Iterate over partitions with a for loop over disk.partitions.values() rather than calling next_partition() 2) Call getFlag() rather than get_flag() 3) Call setFlag() to enable a flag, call unsetFlag() to disable a flag. 4) Reference the active property rather than calling the is_active() method. And other fixes. --- bootloader.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'bootloader.py') diff --git a/bootloader.py b/bootloader.py index eedd64211..301a8dd0c 100644 --- a/bootloader.py +++ b/bootloader.py @@ -65,12 +65,10 @@ def bootloaderSetupChoices(anaconda): bootPart = None for drive in drives: disk = anaconda.id.diskset.disks[drive] - part = disk.next_partition() - while part: - if part.is_active() and partedUtils.isEfiSystemPartition(part): + for part in disk.partitions.values(): + if part.active and partedUtils.isEfiSystemPartition(part): bootPart = part.getDeviceNodeName() break - part = disk.next_partition(part) if bootPart: break if bootPart: @@ -80,18 +78,16 @@ def bootloaderSetupChoices(anaconda): anaconda.id.fsset.add(FileSystemSetEntry(dev, None, fileSystemTypeGet("efi"))) # iSeries bootloader on upgrades - if iutil.getPPCMachine() == "iSeries" and not anaconda.id.bootloader.device: + if iutil.getPPCMachine() == "iSeries" and not anaconda.id.bootloader.device: drives = anaconda.id.diskset.disks.keys() drives.sort() bootPart = None for drive in drives: disk = anaconda.id.diskset.disks[drive] - part = disk.next_partition() - while part: - if part.is_active() and part.get_flag(parted.PARTITION_PREP): + for part in disk.partitions.values(): + if part.active and part.getFlag(parted.PARTITION_PREP): bootPart = part.getDeviceNodeName() break - part = disk.next_partition(part) if bootPart: break if bootPart: -- cgit