Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take partition label from blivet #5876

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyanaconda/modules/common/structures/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def attrs(self) -> Dict[Str, Str]:
path-id

Attributes for partitions:
partition-label
partition-type-name

:return: a dictionary of attributes
"""
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/storage/devicetree/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _set_device_data(self, device, data):
data.attrs["uuid"] = self._get_attribute(device, "uuid")

if isinstance(device, PartitionDevice):
data.attrs["partition-label"] = self._get_attribute(device.parted_partition, "name")
data.attrs["partition-type-name"] = self._get_attribute(device, "part_type_name")

def _set_device_data_dasd(self, device, data):
"""Set data for a DASD device."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
from pyanaconda.modules.storage.devicetree.rescue import FindExistingSystemsTask, \
MountExistingSystemTask
from pyanaconda.modules.storage.devicetree.root import Root
from parted import PARTITION_NORMAL


class DeviceTreeInterfaceTestCase(unittest.TestCase):
Expand Down Expand Up @@ -357,19 +356,15 @@ def test_get_parted_device_data(self):
size=Size("500 MiB"),
fmt=get_format("ext4", exists=True)
)
attrs = {
'type': PARTITION_NORMAL,
'getLength.return_value': int(sda1.size),
'getFlag.return_value': 0,
'name': "Microsoft reserved partition",
'number': 1
}
sda1._parted_partition = Mock()
sda1._parted_partition.configure_mock(**attrs)
self._add_device(sda1)

data = self.interface.GetDeviceData("dev1")
assert data['attrs']['partition-label'] == "Microsoft reserved partition"
with patch.object(PartitionDevice,
'part_type_name',
new_callable=PropertyMock) as mock_part_type_name:
mock_part_type_name.return_value = "Microsoft reserved partition"

data = self.interface.GetDeviceData("dev1")
assert data['attrs']['partition-type-name'] == "Microsoft reserved partition"

def test_get_format_data(self):
"""Test GetFormatData."""
Expand Down