From ce146ab28a517beb3136432feeb44866ddf94137 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Wed, 27 Jul 2022 17:22:08 +1200 Subject: [PATCH] add .path to Raid so for_client(raid-with-partitions) works --- subiquity/common/filesystem/tests/test_labels.py | 10 ++++++++++ subiquity/models/filesystem.py | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/subiquity/common/filesystem/tests/test_labels.py b/subiquity/common/filesystem/tests/test_labels.py index 75a66d99..a24f7e4d 100644 --- a/subiquity/common/filesystem/tests/test_labels.py +++ b/subiquity/common/filesystem/tests/test_labels.py @@ -18,12 +18,14 @@ import unittest from subiquity.common.filesystem.labels import ( annotations, + for_client, usage_labels, ) from subiquity.models.tests.test_filesystem import ( make_model, make_model_and_disk, make_model_and_partition, + make_model_and_raid, make_partition, ) @@ -123,3 +125,11 @@ class TestUsageLabels(unittest.TestCase): self.assertEqual( usage_labels(partition), ["to be reformatted as ext4", "mounted at /"]) + + +class TestForClient(unittest.TestCase): + + def test_for_client_raid_parts(self): + model, raid = make_model_and_raid() + make_partition(model, raid) + for_client(raid) diff --git a/subiquity/models/filesystem.py b/subiquity/models/filesystem.py index 9becc0c4..de46e865 100644 --- a/subiquity/models/filesystem.py +++ b/subiquity/models/filesystem.py @@ -772,6 +772,12 @@ class Raid(_Device): container = attributes.ref(backlink="_subvolumes", default=None) # Raid _subvolumes = attributes.backlink(default=attr.Factory(list)) + @property + def path(self): + # This is just here to make for_client(raid-with-partitions) work. It + # might not be very accurate. + return '/dev/md/' + self.name + @property def size(self): if self.preserve and self._m._probe_data: