Skip to content

Commit

Permalink
Quickfix of merge bugs
Browse files Browse the repository at this point in the history
- fixed bugs from manual merging
- updated test
  • Loading branch information
japokorn committed Jun 7, 2016
1 parent 64c3c41 commit e74080c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
1 change: 0 additions & 1 deletion blivet/blivet.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def __init__(self, ksdata=None):
self.clear_part_choice = None
self.encrypted_autopart = False
self.encryption_passphrase = None
self.autopart_type = AUTOPART_TYPE_LVM
self.encryption_cipher = None
self.escrow_certificates = {}
self.autopart_escrow_cert = None
Expand Down
2 changes: 1 addition & 1 deletion blivet/devicetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ def __init__(self, passphrase=None, luks_dict=None, ignored_disks=None, exclusiv
self.luks_dict_passed = luks_dict

DeviceTreeBase.__init__(self, ignored_disks=ignored_disks, exclusive_disks=exclusive_disks)
PopulatorMixin.__init__(self, passphrase=passphrase, luks_dict=luks_dict_passed, disk_images=disk_images)
PopulatorMixin.__init__(self, passphrase=passphrase, luks_dict=self.luks_dict_passed, disk_images=disk_images)
EventHandlerMixin.__init__(self)

# pylint: disable=arguments-differ
Expand Down
9 changes: 8 additions & 1 deletion blivet/osinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -1622,15 +1622,22 @@ def _update_custom_storage_ksdata(self):
MDRaidArrayDevice: ("RaidData", "raid"),
BTRFSDevice: ("BTRFSData", "btrfs")}

# list comprehension that builds device ancestors should not get None as a member
# when searching for bootloader devices
bootloader_devices = []
if self.bootloader_device is not None:
bootloader_devices.append(self.bootloader_device)

# make a list of ancestors of all used devices
devices = list(set(a for d in list(self.mountpoints.values()) + self.swaps
devices = list(set(a for d in list(self.mountpoints.values()) + self.swaps + bootloader_devices
for a in d.ancestors))

# devices which share information with their distinct raw device
complementary_devices = [d for d in devices if d.raw_device is not d]

devices.sort(key=lambda d: len(d.ancestors))
for device in devices:

cls = next((c for c in ks_map if isinstance(device, c)), None)
if cls is None:
log.info("omitting ksdata: %s", device)
Expand Down
8 changes: 5 additions & 3 deletions tests/blivet_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from unittest.mock import patch
from pykickstart.version import returnClassForVersion
from blivet import Blivet
from blivet.osinstall import InstallerStorage
from blivet.devices import PartitionDevice
from blivet import formats
from blivet.size import Size
Expand All @@ -18,21 +19,22 @@ def test_bootloader_in_kickstart(self):
in the kickstart data
'''

with patch('blivet.blivet.Blivet.bootloader_device', new_callable=PropertyMock) as mock_bootloader_device:
with patch('blivet.blivet.Blivet.mountpoints', new_callable=PropertyMock) as mock_mountpoints:
with patch('blivet.osinstall.InstallerStorage.bootloader_device', new_callable=PropertyMock) as mock_bootloader_device:
with patch('blivet.osinstall.InstallerStorage.mountpoints', new_callable=PropertyMock) as mock_mountpoints:
# set up prepboot partition
bootloader_device_obj = PartitionDevice("test_partition_device")
bootloader_device_obj.size = Size('5 MiB')
bootloader_device_obj.format = formats.get_format("prepboot")

blivet_obj = Blivet()
blivet_obj = InstallerStorage()

# mountpoints must exist for update_ksdata to run
mock_bootloader_device.return_value = bootloader_device_obj
mock_mountpoints.values.return_value = []

# initialize ksdata
test_ksdata = returnClassForVersion()()

blivet_obj.ksdata = test_ksdata
blivet_obj.update_ksdata()

Expand Down

0 comments on commit e74080c

Please sign in to comment.