← Back to team overview

curtin-dev team mailing list archive

[Merge] ~sil2100/curtin:default-dm_name-id into curtin:master

 

Łukasz Zemczak has proposed merging ~sil2100/curtin:default-dm_name-id into curtin:master.

Commit message:
Default to dm_name being id if empty earlier in dm_crypt_handler()

Requested reviews:
  curtin developers (curtin-dev)
Related bugs:
  Bug #1874243 in curtin: " An error occured handling 'dm_crypt-0': TypeError - join() argument must be str or bytes, not 'NoneType'"
  https://bugs.launchpad.net/curtin/+bug/1874243

For more details, see:
https://code.launchpad.net/~sil2100/curtin/+git/curtin/+merge/382768

Default to dm_name being id if empty earlier in dm_crypt_handler().

In other parts of the code, when deciding the path for dmcrypt_dev, we default to 'id' when 'dm_name' is not defined. We ideally want that to happen in all the cases. The defaulting has been there already but a bit too late.
-- 
Your team curtin developers is requested to review the proposed merge of ~sil2100/curtin:default-dm_name-id into curtin:master.
diff --git a/curtin/commands/block_meta.py b/curtin/commands/block_meta.py
index 7fbd89f..86792c9 100644
--- a/curtin/commands/block_meta.py
+++ b/curtin/commands/block_meta.py
@@ -1321,13 +1321,13 @@ def dm_crypt_handler(info, storage_config):
     keysize = info.get('keysize')
     cipher = info.get('cipher')
     dm_name = info.get('dm_name')
+    if not dm_name:
+        dm_name = info.get('id')
     dmcrypt_dev = os.path.join("/dev", "mapper", dm_name)
     preserve = config.value_as_boolean(info.get('preserve'))
     if not volume:
         raise ValueError("volume for cryptsetup to operate on must be \
             specified")
-    if not dm_name:
-        dm_name = info.get('id')
 
     volume_path = get_path_to_storage_volume(volume, storage_config)
     volume_byid_path = block.disk_to_byid_path(volume_path)

Follow ups