← Back to team overview

curtin-dev team mailing list archive

[Merge] ~dbungert/curtin:get-resize-fstypes into curtin:master

 

Dan Bungert has proposed merging ~dbungert/curtin:get-resize-fstypes into curtin:master.

Commit message:
block: provide get_resize_fstypes

So callers can know which fs types we can and can't resize.

Requested reviews:
  curtin developers (curtin-dev)

For more details, see:
https://code.launchpad.net/~dbungert/curtin/+git/curtin/+merge/419517
-- 
Your team curtin developers is requested to review the proposed merge of ~dbungert/curtin:get-resize-fstypes into curtin:master.
diff --git a/curtin/block/__init__.py b/curtin/block/__init__.py
index f37ebee..49b062f 100644
--- a/curtin/block/__init__.py
+++ b/curtin/block/__init__.py
@@ -1368,4 +1368,9 @@ def discover():
     return {}
 
 
+def get_resize_fstypes():
+    from curtin.commands.block_meta_v2 import resizers
+    return {fstype for fstype in resizers.keys()}
+
+
 # vi: ts=4 expandtab syntax=python
diff --git a/tests/unittests/test_block.py b/tests/unittests/test_block.py
index 6d9b776..7a73b69 100644
--- a/tests/unittests/test_block.py
+++ b/tests/unittests/test_block.py
@@ -927,4 +927,12 @@ class TestSfdiskInfo(CiTestCase):
         self.assertEqual([], self.m_load_json.call_args_list)
 
 
+class TestResize(CiTestCase):
+    def test_basic(self):
+        resizers = 'curtin.commands.block_meta_v2.resizers'
+        values = {'a': 1, 'b': 2}
+        with mock.patch.dict(resizers, values, clear=True):
+            self.assertEqual({'a', 'b'}, block.get_resize_fstypes())
+
+
 # vi: ts=4 expandtab syntax=python

Follow ups